home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / elm / elm2.4.p23e.Z / elm2.4.p23e
Encoding:
Text File  |  1993-09-26  |  79.8 KB  |  2,595 lines

  1. Subject: elm 2.4 Patch #23e
  2. Summary: This is an official patch for elm 2.4 system.  Please apply it.
  3. Priority: HIGH
  4.  
  5. THIS IS PART 5 OF A 5 PART PATCH
  6.  
  7. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your elm source
  8.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  9.     If you don't have the patch program, apply the following by hand,
  10.     or get patch (version 2.0, latest patchlevel).
  11.  
  12.     After patching:
  13.         sh Configure
  14.         make
  15.         make install
  16.  
  17.     If patch indicates that patchlevel is the wrong version, you may need
  18.     to apply one or more previous patches, or the patch may already
  19.     have been applied.  See the patchlevel.h file to find out what has or
  20.     has not been applied.  In any event, don't continue with the patch.
  21.  
  22.     If you are missing previous patches they can be obtained from our:
  23.     archive server.
  24.  
  25.     Syd Weinstein
  26.     elm@DSI.COM
  27.  
  28.     The patches are available from the dsinc archive server
  29.     Send the following message to archive-server@DSI.COM for
  30.     a list of available patches:
  31.  
  32.     Subject: patch list
  33.     send index elm
  34.  
  35. Index: src/showmsg.c
  36. Prereq: 5.13
  37. *** ../elm2.4/src/showmsg.c    Sat May  8 16:25:51 1993
  38. --- src/showmsg.c    Sun Aug 22 22:46:09 1993
  39. ***************
  40. *** 1,8 ****
  41.   
  42. ! static char rcsid[] = "@(#)$Id: showmsg.c,v 5.13 1993/05/08 20:25:33 syd Exp $";
  43.   
  44.   /*******************************************************************************
  45. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  46.    *
  47.    *             Copyright (c) 1988-1992 USENET Community Trust
  48.    *             Copyright (c) 1986,1987 Dave Taylor
  49. --- 1,8 ----
  50.   
  51. ! static char rcsid[] = "@(#)$Id: showmsg.c,v 5.15 1993/08/23 02:46:07 syd Exp $";
  52.   
  53.   /*******************************************************************************
  54. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  55.    *
  56.    *             Copyright (c) 1988-1992 USENET Community Trust
  57.    *             Copyright (c) 1986,1987 Dave Taylor
  58. ***************
  59. *** 14,19 ****
  60. --- 14,35 ----
  61.    *
  62.    *******************************************************************************
  63.    * $Log: showmsg.c,v $
  64. +  * Revision 5.15  1993/08/23  02:46:07  syd
  65. +  * Don't declare _exit() if <unistd.h> already did it.
  66. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  67. +  *
  68. +  * Revision 5.14  1993/08/03  19:28:39  syd
  69. +  * Elm tries to replace the system toupper() and tolower() on current
  70. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  71. +  * collide during linking with routines in isctype.o.  This patch adds
  72. +  * a Configure test to determine whether replacements are really needed
  73. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  74. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  75. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  76. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  77. +  * were dropped.
  78. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  79. +  *
  80.    * Revision 5.13  1993/05/08  20:25:33  syd
  81.    * Add sleepmsg to control transient message delays
  82.    * From: Syd
  83. ***************
  84. *** 85,102 ****
  85.   
  86.   #include "headers.h"
  87.   #include "s_elm.h"
  88. - #include <ctype.h>
  89.   #include <errno.h>
  90.   
  91.   #ifdef BSD
  92.   # include <sys/wait.h>
  93. ! # undef       tolower
  94.   #endif
  95.   
  96.   extern int errno;
  97.   
  98.   extern char *elm_date_str(), *error_description();
  99. - void   _exit();
  100.   
  101.   int    memory_lock = FALSE;    /* is it available?? */
  102.   int    pipe_abort  = FALSE;    /* did we receive a SIGNAL(SIGPIPE)? */
  103. --- 101,119 ----
  104.   
  105.   #include "headers.h"
  106.   #include "s_elm.h"
  107.   #include <errno.h>
  108.   
  109.   #ifdef BSD
  110.   # include <sys/wait.h>
  111. ! #endif
  112. ! #ifndef I_UNISTD
  113. ! void _exit();
  114.   #endif
  115.   
  116.   extern int errno;
  117.   
  118.   extern char *elm_date_str(), *error_description();
  119.   
  120.   int    memory_lock = FALSE;    /* is it available?? */
  121.   int    pipe_abort  = FALSE;    /* did we receive a SIGNAL(SIGPIPE)? */
  122.  
  123. Index: src/signals.c
  124. Prereq: 5.8
  125. *** ../elm2.4/src/signals.c    Sun Apr 11 23:04:59 1993
  126. --- src/signals.c    Tue Aug  3 15:10:51 1993
  127. ***************
  128. *** 1,8 ****
  129.   
  130. ! static char rcsid[] = "@(#)$Id: signals.c,v 5.8 1993/04/12 03:04:58 syd Exp $";
  131.   
  132.   /*******************************************************************************
  133. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  134.    *
  135.    *            Copyright (c) 1988-1992 USENET Community Trust
  136.    *            Copyright (c) 1986,1987 Dave Taylor
  137. --- 1,8 ----
  138.   
  139. ! static char rcsid[] = "@(#)$Id: signals.c,v 5.9 1993/08/03 19:10:50 syd Exp $";
  140.   
  141.   /*******************************************************************************
  142. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  143.    *
  144.    *            Copyright (c) 1988-1992 USENET Community Trust
  145.    *            Copyright (c) 1986,1987 Dave Taylor
  146. ***************
  147. *** 14,19 ****
  148. --- 14,26 ----
  149.    *
  150.    *******************************************************************************
  151.    * $Log: signals.c,v $
  152. +  * Revision 5.9  1993/08/03  19:10:50  syd
  153. +  * Patch for Elm 2.4 PL22 to correct handling of SIGWINCH signals on
  154. +  * DecStations with Ultrix 4.2.
  155. +  * The problem was that elm running in an xterm exits silently when the
  156. +  * window is resize. This was caused by incorrect signal handling for BSD.
  157. +  * From: vogt@isa.de
  158. +  *
  159.    * Revision 5.8  1993/04/12  03:04:58  syd
  160.    * The USR2 signal lost messages on some OS:es and did an unnecessary resync
  161.    * on others.
  162. ***************
  163. *** 201,210 ****
  164.   SIGHAND_TYPE
  165.   winch_signal(sig)
  166.   {
  167.   #ifndef    BSD
  168.       signal(SIGWINCH, winch_signal);
  169.   #endif
  170. -     resize_screen = 1;
  171.   }
  172.   #endif
  173.   
  174. --- 208,220 ----
  175.   SIGHAND_TYPE
  176.   winch_signal(sig)
  177.   {
  178. +     resize_screen = 1;
  179.   #ifndef    BSD
  180.       signal(SIGWINCH, winch_signal);
  181. + #else
  182. +     if (InGetPrompt)
  183. +       longjmp(GetPromptBuf, 1);
  184.   #endif
  185.   }
  186.   #endif
  187.   
  188.  
  189. Index: src/string2.c
  190. Prereq: 5.1
  191. *** ../elm2.4/src/string2.c    Sat Oct  3 18:59:20 1992
  192. --- src/string2.c    Tue Aug  3 15:29:21 1993
  193. ***************
  194. *** 1,8 ****
  195.   
  196. ! static char rcsid[] = "@(#)$Id: string2.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  197.   
  198.   /*******************************************************************************
  199. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  200.    *
  201.    *             Copyright (c) 1988-1992 USENET Community Trust
  202.    *             Copyright (c) 1986,1987 Dave Taylor
  203. --- 1,8 ----
  204.   
  205. ! static char rcsid[] = "@(#)$Id: string2.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  206.   
  207.   /*******************************************************************************
  208. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  209.    *
  210.    *             Copyright (c) 1988-1992 USENET Community Trust
  211.    *             Copyright (c) 1986,1987 Dave Taylor
  212. ***************
  213. *** 14,19 ****
  214. --- 14,31 ----
  215.    *
  216.    *******************************************************************************
  217.    * $Log: string2.c,v $
  218. +  * Revision 5.2  1993/08/03  19:28:39  syd
  219. +  * Elm tries to replace the system toupper() and tolower() on current
  220. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  221. +  * collide during linking with routines in isctype.o.  This patch adds
  222. +  * a Configure test to determine whether replacements are really needed
  223. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  224. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  225. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  226. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  227. +  * were dropped.
  228. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  229. +  *
  230.    * Revision 5.1  1992/10/03  22:58:40  syd
  231.    * Initial checkin as of 2.4 Release at PL0
  232.    *
  233. ***************
  234. *** 26,37 ****
  235.   **/
  236.   
  237.   #include "headers.h"
  238. - #include <ctype.h>
  239. - #ifdef BSD
  240. - #undef tolower
  241. - #undef toupper
  242. - #endif
  243.   
  244.   
  245.   int
  246. --- 38,43 ----
  247.  
  248. Index: src/strings.c
  249. Prereq: 5.6
  250. *** ../elm2.4/src/strings.c    Tue Jan 19 22:02:41 1993
  251. --- src/strings.c    Tue Aug  3 15:29:23 1993
  252. ***************
  253. *** 1,8 ****
  254.   
  255. ! static char rcsid[] = "@(#)$Id: strings.c,v 5.6 1993/01/20 03:02:19 syd Exp $";
  256.   
  257.   /*******************************************************************************
  258. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  259.    *
  260.    *             Copyright (c) 1986, 1987 Dave Taylor
  261.    *             Copyright (c) 1988, 1989, 1990, 1991 USENET Community Trust
  262. --- 1,8 ----
  263.   
  264. ! static char rcsid[] = "@(#)$Id: strings.c,v 5.8 1993/08/03 19:28:39 syd Exp $";
  265.   
  266.   /*******************************************************************************
  267. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  268.    *
  269.    *             Copyright (c) 1986, 1987 Dave Taylor
  270.    *             Copyright (c) 1988, 1989, 1990, 1991 USENET Community Trust
  271. ***************
  272. *** 14,19 ****
  273. --- 14,35 ----
  274.    *
  275.    *******************************************************************************
  276.    * $Log: strings.c,v $
  277. +  * Revision 5.8  1993/08/03  19:28:39  syd
  278. +  * Elm tries to replace the system toupper() and tolower() on current
  279. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  280. +  * collide during linking with routines in isctype.o.  This patch adds
  281. +  * a Configure test to determine whether replacements are really needed
  282. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  283. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  284. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  285. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  286. +  * were dropped.
  287. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  288. +  *
  289. +  * Revision 5.7  1993/07/20  02:26:58  syd
  290. +  * Fix copy_sans_escape handling of tabs
  291. +  * From: Syd via code from G A Smant
  292. +  *
  293.    * Revision 5.6  1993/01/20  03:02:19  syd
  294.    * Move string declarations to defs.h
  295.    * From: Syd
  296. ***************
  297. *** 55,67 ****
  298.   
  299.   #include "headers.h"
  300.   #include "s_elm.h"
  301. - #include <ctype.h>
  302.   
  303. - #ifdef BSD
  304. - #undef tolower
  305. - #undef toupper
  306. - #endif
  307.   /** forward declarations **/
  308.   
  309.   char *format_long(), *strip_commas(), *tail_of_string(),
  310. --- 71,77 ----
  311. ***************
  312. *** 81,89 ****
  313.   
  314.       while (i < len && j < len && source[i] != '\0') {
  315.         if (source[i] == '\t') {
  316. !          n = next_tab(j) - j;
  317.            while (n-- && j < len)
  318.            dest[j++] = ' ';
  319.         } else if (iscntrl(source[i])) {
  320.            dest[j++] = '^';
  321.            if (j < len)
  322. --- 91,100 ----
  323.   
  324.       while (i < len && j < len && source[i] != '\0') {
  325.         if (source[i] == '\t') {
  326. !          n = (next_tab(j) - j) - 1;
  327.            while (n-- && j < len)
  328.            dest[j++] = ' ';
  329. +          i++;
  330.         } else if (iscntrl(source[i])) {
  331.            dest[j++] = '^';
  332.            if (j < len)
  333. ***************
  334. *** 200,209 ****
  335.           break;
  336.   
  337.         while (--len >= 0) {
  338. !         if (islower(*buffer))
  339. !           *first = *buffer;
  340. !         else
  341. !           *first = tolower(*buffer);
  342.           buffer++;
  343.           first++;
  344.         }
  345. --- 211,217 ----
  346.           break;
  347.   
  348.         while (--len >= 0) {
  349. !         *first = tolower(*buffer);
  350.           buffer++;
  351.           first++;
  352.         }
  353. ***************
  354. *** 219,228 ****
  355.    */
  356.   
  357.       for (; *buffer; buffer++, rest++)
  358. !       if (islower(*buffer))
  359. !         *rest = *buffer;
  360. !       else
  361. !         *rest = tolower(*buffer);
  362.   
  363.       *rest = '\0';
  364.   
  365. --- 227,233 ----
  366.    */
  367.   
  368.       for (; *buffer; buffer++, rest++)
  369. !       *rest = tolower(*buffer);
  370.   
  371.       *rest = '\0';
  372.   
  373.  
  374. Index: src/syscall.c
  375. Prereq: 5.7
  376. *** ../elm2.4/src/syscall.c    Sat May  8 16:25:52 1993
  377. --- src/syscall.c    Sun Aug 22 22:46:10 1993
  378. ***************
  379. *** 1,8 ****
  380.   
  381. ! static char rcsid[] = "@(#)$Id: syscall.c,v 5.7 1993/01/20 03:48:08 syd Exp $";
  382.   
  383.   /*******************************************************************************
  384. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  385.    *
  386.    *            Copyright (c) 1988-1992 USENET Community Trust
  387.    *            Copyright (c) 1986,1987 Dave Taylor
  388. --- 1,8 ----
  389.   
  390. ! static char rcsid[] = "@(#)$Id: syscall.c,v 5.8 1993/08/23 02:46:07 syd Exp $";
  391.   
  392.   /*******************************************************************************
  393. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  394.    *
  395.    *            Copyright (c) 1988-1992 USENET Community Trust
  396.    *            Copyright (c) 1986,1987 Dave Taylor
  397. ***************
  398. *** 14,23 ****
  399.    *
  400.    *******************************************************************************
  401.    * $Log: syscall.c,v $
  402. !  * Revision 5.7  1993/01/20  03:48:08  syd
  403. !  * Fix not to use vfork if SY_ENV_SHELL is set, as this causes the
  404. !  * parent environment to be modified.
  405. !  * From: Syd
  406.    *
  407.    * Revision 5.7  1993/01/20  03:48:08  syd
  408.    * Fix not to use vfork if SY_ENV_SHELL is set, as this causes the
  409. --- 14,22 ----
  410.    *
  411.    *******************************************************************************
  412.    * $Log: syscall.c,v $
  413. !  * Revision 5.8  1993/08/23  02:46:07  syd
  414. !  * Don't declare _exit() if <unistd.h> already did it.
  415. !  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  416.    *
  417.    * Revision 5.7  1993/01/20  03:48:08  syd
  418.    * Fix not to use vfork if SY_ENV_SHELL is set, as this causes the
  419. ***************
  420. *** 69,76 ****
  421.   #  include <sys/wait.h>
  422.   #endif
  423.   
  424.   char *argv_zero();    
  425. - void  _exit();
  426.   
  427.   #ifdef ALLOW_SUBSHELL
  428.   
  429. --- 68,78 ----
  430.   #  include <sys/wait.h>
  431.   #endif
  432.   
  433. + #ifndef I_UNISTD
  434. + void _exit();
  435. + #endif
  436.   char *argv_zero();    
  437.   
  438.   #ifdef ALLOW_SUBSHELL
  439.   
  440.  
  441. Index: src/utils.c
  442. Prereq: 5.10
  443. *** ../elm2.4/src/utils.c    Sun Apr 11 23:11:50 1993
  444. --- src/utils.c    Sun Sep 26 21:52:09 1993
  445. ***************
  446. *** 1,8 ****
  447.   
  448. ! static char rcsid[] = "@(#)$Id: utils.c,v 5.10 1993/04/12 03:11:50 syd Exp $";
  449.   
  450.   /*******************************************************************************
  451. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  452.    *
  453.    *            Copyright (c) 1988-1992 USENET Community Trust
  454.    *            Copyright (c) 1986,1987 Dave Taylor
  455. --- 1,8 ----
  456.   
  457. ! static char rcsid[] = "@(#)$Id: utils.c,v 5.15 1993/09/27 01:51:38 syd Exp $";
  458.   
  459.   /*******************************************************************************
  460. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  461.    *
  462.    *            Copyright (c) 1988-1992 USENET Community Trust
  463.    *            Copyright (c) 1986,1987 Dave Taylor
  464. ***************
  465. *** 14,19 ****
  466. --- 14,50 ----
  467.    *
  468.    *******************************************************************************
  469.    * $Log: utils.c,v $
  470. +  * Revision 5.15  1993/09/27  01:51:38  syd
  471. +  * Add elm_chown to consolidate for Xenix not allowing -1
  472. +  * From: Syd
  473. +  *
  474. +  * Revision 5.14  1993/09/20  19:21:12  syd
  475. +  * make fflush conditional on the unit being open
  476. +  * From: Syd
  477. +  *
  478. +  * Revision 5.13  1993/09/19  23:37:29  syd
  479. +  * I found a few places more where the code was missing a call
  480. +  * to fflush() before it called unlock() and fclose()/exit()
  481. +  * right after unlocking the mail drop.
  482. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  483. +  *
  484. +  * Revision 5.12  1993/08/23  03:26:24  syd
  485. +  * Try setting group id separate from user id in chown to
  486. +  * allow restricted systems to change group id of file
  487. +  * From: Syd
  488. +  *
  489. +  * Revision 5.11  1993/08/03  19:28:39  syd
  490. +  * Elm tries to replace the system toupper() and tolower() on current
  491. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  492. +  * collide during linking with routines in isctype.o.  This patch adds
  493. +  * a Configure test to determine whether replacements are really needed
  494. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  495. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  496. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  497. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  498. +  * were dropped.
  499. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  500. +  *
  501.    * Revision 5.10  1993/04/12  03:11:50  syd
  502.    * nameof() didn't check that the character after the common string was /, thus
  503.    * (if Mail is the folderdir) Maildir/x was made to be =dir/x.
  504. ***************
  505. *** 69,81 ****
  506.   #include "headers.h"
  507.   #include "s_elm.h"
  508.   #include <sys/stat.h>
  509. - #include <ctype.h>
  510.   #include <errno.h>
  511.   
  512. - #ifdef BSD
  513. - #undef tolower
  514. - #endif
  515.   extern int errno;
  516.   
  517.   create_new_folders()
  518. --- 100,107 ----
  519. ***************
  520. *** 95,101 ****
  521.       (void) system_call(com, 0);
  522.   #endif /* MKDIR */
  523.   
  524. !     chown(folders, userid, groupid);
  525.   }
  526.   
  527.   create_new_elmdir()
  528. --- 121,127 ----
  529.       (void) system_call(com, 0);
  530.   #endif /* MKDIR */
  531.   
  532. !     (void) elm_chown(folders, userid, groupid);
  533.   }
  534.   
  535.   create_new_elmdir()
  536. ***************
  537. *** 118,124 ****
  538.       (void) system_call(com, 0);
  539.   #endif /* MKDIR */
  540.   
  541. !     chown( source, userid, groupid);
  542.   }
  543.   
  544.   move_old_files_to_new()
  545. --- 144,150 ----
  546.       (void) system_call(com, 0);
  547.   #endif /* MKDIR */
  548.   
  549. !     (void) elm_chown( source, userid, groupid);
  550.   }
  551.   
  552.   move_old_files_to_new()
  553. ***************
  554. *** 311,316 ****
  555. --- 337,345 ----
  556.         (void) unlink(cur_tempfolder);
  557.       }
  558.   
  559. +     if (mailfile)
  560. +         fflush (mailfile);
  561.       unlock();                /* remove lock file if any */
  562.   
  563.       if (do_cursor) {
  564. ***************
  565. *** 359,364 ****
  566. --- 388,397 ----
  567.         Raw(OFF);
  568.       }
  569.   
  570. +     if (mailfile)
  571. +         fflush (mailfile);
  572. +     unlock ();
  573.       exit(0);
  574.   }
  575.   
  576. ***************
  577. *** 398,403 ****
  578. --- 431,439 ----
  579.   
  580.       (void) unlink(cur_tempfolder);            /* temp mailbox */
  581.   
  582. +     if (mailfile)
  583. +         fflush (mailfile);
  584.       if (do_cursor) {
  585.         MoveCursor(LINES,0);
  586.         NewLine();
  587. ***************
  588. *** 479,481 ****
  589. --- 515,533 ----
  590.   
  591.       return( (char *) buffer);
  592.   }
  593. + int elm_chown(file, userid, groupid)
  594. + char *file;
  595. + int userid, groupid;
  596. + {
  597. + #ifdef CHOWN_NEG1
  598. +     int status;
  599. +     status = chown(file, -1, groupid);
  600. +     chown(file, userid, -1);
  601. +     return(status);
  602. + #else
  603. +     return(chown(file, userid, groupid));
  604. + #endif
  605. + }
  606.  
  607. Index: src/wordwrap.c
  608. Prereq: 5.4
  609. *** ../elm2.4/src/wordwrap.c    Sun Apr 11 23:02:40 1993
  610. --- src/wordwrap.c    Tue Aug  3 15:29:25 1993
  611. ***************
  612. *** 1,5 ****
  613.   /*******************************************************************************
  614. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  615.    *
  616.    *            Copyright (c) 1988-1992 USENET Community Trust
  617.    *            Copyright (c) 1986,1987 Dave Taylor
  618. --- 1,8 ----
  619. + static char rcsid[] = "@(#)$Id: wordwrap.c,v 5.6 1993/08/03 19:28:39 syd Exp $";
  620.   /*******************************************************************************
  621. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  622.    *
  623.    *            Copyright (c) 1988-1992 USENET Community Trust
  624.    *            Copyright (c) 1986,1987 Dave Taylor
  625. ***************
  626. *** 11,16 ****
  627. --- 14,35 ----
  628.    *
  629.    *******************************************************************************
  630.    * $Log: wordwrap.c,v $
  631. +  * Revision 5.6  1993/08/03  19:28:39  syd
  632. +  * Elm tries to replace the system toupper() and tolower() on current
  633. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  634. +  * collide during linking with routines in isctype.o.  This patch adds
  635. +  * a Configure test to determine whether replacements are really needed
  636. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  637. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  638. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  639. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  640. +  * were dropped.
  641. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  642. +  *
  643. +  * Revision 5.5  1993/06/10  03:12:10  syd
  644. +  * Add missing rcs id lines
  645. +  * From: Syd
  646. +  *
  647.    * Revision 5.4  1993/04/12  03:02:40  syd
  648.    * Check for EINTR if getchar() returns EOF. Happens after a resume from an
  649.    * interactive stop.
  650. ***************
  651. *** 42,52 ****
  652.   
  653.   #include "headers.h"
  654.   #include <errno.h>
  655. - #include <ctype.h>
  656. - #ifdef BSD
  657. - #  undef tolower
  658. - #endif
  659.   
  660.   extern int errno;        /* system error number */
  661.   
  662. --- 61,66 ----
  663.  
  664. Index: utils/answer.c
  665. Prereq: 5.5
  666. *** ../elm2.4/utils/answer.c    Thu Feb  4 10:32:52 1993
  667. --- utils/answer.c    Tue Aug 10 14:54:15 1993
  668. ***************
  669. *** 1,8 ****
  670.   
  671. ! static char rcsid[] = "@(#)$Id: answer.c,v 5.5 1993/02/04 15:32:52 syd Exp $";
  672.   
  673.   /*******************************************************************************
  674. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  675.    *
  676.    *             Copyright (c) 1988-1992 USENET Community Trust
  677.    *             Copyright (c) 1986,1987 Dave Taylor
  678. --- 1,8 ----
  679.   
  680. ! static char rcsid[] = "@(#)$Id: answer.c,v 5.7 1993/08/10 18:54:13 syd Exp $";
  681.   
  682.   /*******************************************************************************
  683. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  684.    *
  685.    *             Copyright (c) 1988-1992 USENET Community Trust
  686.    *             Copyright (c) 1986,1987 Dave Taylor
  687. ***************
  688. *** 14,19 ****
  689. --- 14,35 ----
  690.    *
  691.    *******************************************************************************
  692.    * $Log: answer.c,v $
  693. +  * Revision 5.7  1993/08/10  18:54:13  syd
  694. +  * A change to answer:s mail command to be like those of elm and filter.
  695. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  696. +  *
  697. +  * Revision 5.6  1993/08/03  19:28:39  syd
  698. +  * Elm tries to replace the system toupper() and tolower() on current
  699. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  700. +  * collide during linking with routines in isctype.o.  This patch adds
  701. +  * a Configure test to determine whether replacements are really needed
  702. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  703. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  704. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  705. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  706. +  * were dropped.
  707. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  708. +  *
  709.    * Revision 5.5  1993/02/04  15:32:52  syd
  710.    * Add cast to silence compiler warning.
  711.    * From: chip@chinacat.unicom.com (Chip Rosenthal)
  712. ***************
  713. *** 50,60 ****
  714.   #include "ndbz.h"
  715.   #include "s_answer.h"
  716.   #include "sysdefs.h"
  717. - #include <ctype.h>
  718. - #ifdef BSD
  719. - #undef        tolower
  720. - #endif
  721.   
  722.   #define  ELM        "elm"        /* where the elm program lives */
  723.   
  724. --- 66,71 ----
  725. ***************
  726. *** 250,257 ****
  727.         fclose(fd);
  728.    
  729.         sprintf(buffer, catgets(elm_msg_cat, AnswerSet, AnswerElmCommand,
  730. !          "( ( %s -s \"While You Were Out\" %s ; %s %s) & ) < %s > /dev/null"),
  731. !          ELM, strip_parens(address), remove_cmd, tempfile, tempfile);
  732.   
  733.         system(buffer);
  734.       }
  735. --- 261,268 ----
  736.         fclose(fd);
  737.    
  738.         sprintf(buffer, catgets(elm_msg_cat, AnswerSet, AnswerElmCommand,
  739. !          "( ( %s -s \"While You Were Out\" %s < %s ; %s %s) & ) > /dev/null"),
  740. !          ELM, strip_parens(address), tempfile, remove_cmd, tempfile);
  741.   
  742.         system(buffer);
  743.       }
  744. ***************
  745. *** 270,277 ****
  746.   
  747.       for (i=0, len = strlen(fullname); i < len; i++) {
  748.   
  749. !       if (isupper(fullname[i]))
  750. !          fullname[i] = tolower(fullname[i]);
  751.   
  752.         if (fullname[i] == ' ') 
  753.           if (lastname) {
  754. --- 281,287 ----
  755.   
  756.       for (i=0, len = strlen(fullname); i < len; i++) {
  757.   
  758. !       fullname[i] = tolower(fullname[i]);
  759.   
  760.         if (fullname[i] == ' ') 
  761.           if (lastname) {
  762.  
  763. Index: utils/arepdaem.c
  764. Prereq: 5.12
  765. *** ../elm2.4/utils/arepdaem.c    Mon May 31 15:39:25 1993
  766. --- utils/arepdaem.c    Tue Aug  3 15:29:26 1993
  767. ***************
  768. *** 1,8 ****
  769.   
  770. ! static char rcsid[] = "@(#)$Id: arepdaem.c,v 5.12 1993/05/31 19:39:24 syd Exp $";
  771.   
  772.   /*******************************************************************************
  773. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  774.    *
  775.    *             Copyright (c) 1988-1992 USENET Community Trust
  776.    *             Copyright (c) 1986,1987 Dave Taylor
  777. --- 1,8 ----
  778.   
  779. ! static char rcsid[] = "@(#)$Id: arepdaem.c,v 5.13 1993/08/03 19:28:39 syd Exp $";
  780.   
  781.   /*******************************************************************************
  782. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  783.    *
  784.    *             Copyright (c) 1988-1992 USENET Community Trust
  785.    *             Copyright (c) 1986,1987 Dave Taylor
  786. ***************
  787. *** 14,19 ****
  788. --- 14,31 ----
  789.    *
  790.    *******************************************************************************
  791.    * $Log: arepdaem.c,v $
  792. +  * Revision 5.13  1993/08/03  19:28:39  syd
  793. +  * Elm tries to replace the system toupper() and tolower() on current
  794. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  795. +  * collide during linking with routines in isctype.o.  This patch adds
  796. +  * a Configure test to determine whether replacements are really needed
  797. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  798. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  799. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  800. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  801. +  * were dropped.
  802. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  803. +  *
  804.    * Revision 5.12  1993/05/31  19:39:24  syd
  805.    * check for missing replyfile
  806.    * From: roy@lorien.gatech.edu (Roy Mongiovi)
  807. ***************
  808. *** 107,113 ****
  809.   #endif
  810.   
  811.   #include <sys/stat.h>
  812. - #include <ctype.h>
  813.   #include <errno.h>
  814.   
  815.   #define arep_lock_file    "LCK..arep"
  816. --- 119,124 ----
  817.  
  818. Index: utils/elmalias.c
  819. Prereq: 5.2
  820. *** ../elm2.4/utils/elmalias.c    Sun May 16 16:55:32 1993
  821. --- utils/elmalias.c    Sun Sep 26 21:05:37 1993
  822. ***************
  823. *** 1,8 ****
  824.   
  825. ! static char rcsid[] = "@(#)$Id: elmalias.c,v 5.2 1993/05/16 20:55:32 syd Exp $";
  826.   
  827.   /*******************************************************************************
  828. !  *  The Elm Mail System  -  $Revision: 5.2 $
  829.    *
  830.    *             Copyright (c) 1988-1992 USENET Community Trust
  831.    *             Copyright (c) 1986,1987 Dave Taylor
  832. --- 1,8 ----
  833.   
  834. ! static char rcsid[] = "@(#)$Id: elmalias.c,v 5.8 1993/09/27 01:05:37 syd Exp $";
  835.   
  836.   /*******************************************************************************
  837. !  *  The Elm Mail System  -  $Revision: 5.8 $
  838.    *
  839.    *             Copyright (c) 1988-1992 USENET Community Trust
  840.    *             Copyright (c) 1986,1987 Dave Taylor
  841. ***************
  842. *** 14,19 ****
  843. --- 14,43 ----
  844.    *
  845.    *******************************************************************************
  846.    * $Log: elmalias.c,v $
  847. +  * Revision 5.8  1993/09/27  01:05:37  syd
  848. +  * Eliminate warning about redeclaring getpwuid().
  849. +  * From: riacs!rutgers!tscs.tscs.com!fin!chip (Chip Salzenberg)
  850. +  *
  851. +  * Revision 5.7  1993/09/19  23:12:00  syd
  852. +  * Add ability for elmalias to determine HOME if missing from the environment.
  853. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  854. +  *
  855. +  * Revision 5.6  1993/08/23  02:44:41  syd
  856. +  * fix where checkalias doesn't fully expand multi-database aliases
  857. +  * From: Steve Wolf <woof@atl.hp.com>
  858. +  *
  859. +  * Revision 5.5  1993/08/03  19:23:25  syd
  860. +  * Added -d option to elmalias.
  861. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  862. +  *
  863. +  * Revision 5.4  1993/07/27  20:27:33  syd
  864. +  * fix strchr, Elm uses define to make index strchr when needed
  865. +  * From: Syd
  866. +  *
  867. +  * Revision 5.3  1993/07/20  02:59:53  syd
  868. +  * Support aliases both on 64 bit and 32 bit machines at the same time.
  869. +  * From: Dan Mosedale <mosedale@genome.stanford.edu>
  870. +  *
  871.    * Revision 5.2  1993/05/16  20:55:32  syd
  872.    * fix elmalias bug
  873.    * From: chip@chinacat.unicom.com (Chip Rosenthal)
  874. ***************
  875. *** 60,69 ****
  876.    *    alias chip is address "chip@chinacat.unicom.com" (Chip Rosenthal)
  877.    *
  878.    * Synopsis:
  879. !  *    elmalias [-aensuvV] [-f format] [alias ...]
  880.    *
  881.    * Options:
  882.    *    -a    Display alias name.  Equivalent to -f "%-20.20a %v".
  883.    *    -e    Fully expand alias values.
  884.    *    -f fmt    User-specified output format.
  885.    *    -n    Display name.  Equivalent to -f "%v?n (%n)?".
  886. --- 84,94 ----
  887.    *    alias chip is address "chip@chinacat.unicom.com" (Chip Rosenthal)
  888.    *
  889.    * Synopsis:
  890. !  *    elmalias [-adensuvV] [-f format] [alias ...]
  891.    *
  892.    * Options:
  893.    *    -a    Display alias name.  Equivalent to -f "%-20.20a %v".
  894. +  *    -d    Turn debugging on. Only useful if DEBUG is defined.
  895.    *    -e    Fully expand alias values.
  896.    *    -f fmt    User-specified output format.
  897.    *    -n    Display name.  Equivalent to -f "%v?n (%n)?".
  898. ***************
  899. *** 80,86 ****
  900. --- 105,117 ----
  901.   #include "elmutil.h"
  902.   #include "ndbz.h"
  903.   #include "s_elmalias.h"
  904. + #include <pwd.h>
  905.   
  906. + char *getenv();
  907. + #ifndef    _POSIX_SOURCE
  908. + struct passwd *getpwuid();
  909. + #endif
  910.   /*
  911.    * Maximum number of alias files we can consult.
  912.    */
  913. ***************
  914. *** 114,120 ****
  915.   void usage_error()
  916.   {
  917.       fprintf(stderr, catgets(elm_msg_cat, ElmaliasSet, ElmaliasUsage,
  918. !     "usage: %s [-aenrsuvV] [-f format] [alias ...]\n"), Progname);
  919.       exit(1);
  920.       /*NOTREACHED*/
  921.   }
  922. --- 145,151 ----
  923.   void usage_error()
  924.   {
  925.       fprintf(stderr, catgets(elm_msg_cat, ElmaliasSet, ElmaliasUsage,
  926. !     "usage: %s [-adenrsuvV] [-f format] [alias ...]\n"), Progname);
  927.       exit(1);
  928.       /*NOTREACHED*/
  929.   }
  930. ***************
  931. *** 168,178 ****
  932.       /*
  933.        * Crack command line options.
  934.        */
  935. !     while ((i = getopt(argc, argv, "aef:nrsuvV")) != EOF) {
  936.       switch (i) {
  937.       case 'a':            /* show alias name and value    */
  938.           out_fmt = "%-20.20a %v";
  939.           break;
  940.       case 'e':            /* recursively expand aliases    */
  941.           do_expand = TRUE;
  942.           break;
  943. --- 199,214 ----
  944.       /*
  945.        * Crack command line options.
  946.        */
  947. !     while ((i = getopt(argc, argv, "adef:nrsuvV")) != EOF) {
  948.       switch (i) {
  949.       case 'a':            /* show alias name and value    */
  950.           out_fmt = "%-20.20a %v";
  951.           break;
  952. +     case 'd':
  953. + #ifdef DEBUG
  954. +         debug = 10;
  955. + #endif
  956. +         break;
  957.       case 'e':            /* recursively expand aliases    */
  958.           do_expand = TRUE;
  959.           break;
  960. ***************
  961. *** 273,279 ****
  962.           ar = make_dummy_rec(argv[i]);
  963.           print_alias(out_fmt, ar);
  964.       } else if (do_expand && (ar->type & GROUP)) {
  965. !         exp_print_alias(dblist[d], out_fmt, ar);
  966.       } else {
  967.           print_alias(out_fmt, ar);
  968.       }
  969. --- 309,315 ----
  970.           ar = make_dummy_rec(argv[i]);
  971.           print_alias(out_fmt, ar);
  972.       } else if (do_expand && (ar->type & GROUP)) {
  973. !         exp_print_alias(dblist, out_fmt, ar);
  974.       } else {
  975.           print_alias(out_fmt, ar);
  976.       }
  977. ***************
  978. *** 297,309 ****
  979.   {
  980.       char *home, *fname;
  981.       DBZ *db;
  982. !     extern char *getenv();
  983.   
  984. !     if ((home = getenv("HOME")) == NULL) {
  985. !     fprintf(stderr, catgets(elm_msg_cat, ElmaliasSet,
  986. !         ElmaliasCannotDetermineHome,
  987. !         "%s: cannot determine your HOME directory\n"), Progname);
  988. !     exit(1);
  989.       }
  990.       fname = (char *)safe_malloc(strlen(home) + 1 + strlen(ALIAS_DATA) + 1);
  991.       (void) strcat(strcat(strcpy(fname, home), "/"), ALIAS_DATA);
  992. --- 333,349 ----
  993.   {
  994.       char *home, *fname;
  995.       DBZ *db;
  996. !     struct passwd *pw;
  997.   
  998. !     if ((home = getenv("HOME")) == NULL || *home == '\0') {
  999. !     if ((pw = getpwuid(getuid())) == NULL) {
  1000. !         fprintf(stderr, catgets(elm_msg_cat, ElmaliasSet,
  1001. !         ElmaliasCannotDetermineHome,
  1002. !         "%s: cannot determine your HOME directory\n"), Progname);
  1003. !         exit(1);
  1004. !     }
  1005. !     home = pw->pw_dir;
  1006. !     endpwent();
  1007.       }
  1008.       fname = (char *)safe_malloc(strlen(home) + 1 + strlen(ALIAS_DATA) + 1);
  1009.       (void) strcat(strcat(strcpy(fname, home), "/"), ALIAS_DATA);
  1010. ***************
  1011. *** 336,343 ****
  1012.   /*
  1013.    * Recursively expand out a list of addresses and print the expansions.
  1014.    */
  1015. ! void exp_print_alias(db, fmt, ar)
  1016. ! DBZ *db;
  1017.   char *fmt;
  1018.   struct alias_rec *ar;
  1019.   {
  1020. --- 376,383 ----
  1021.   /*
  1022.    * Recursively expand out a list of addresses and print the expansions.
  1023.    */
  1024. ! void exp_print_alias(dblist, fmt, ar)
  1025. ! DBZ *dblist[];
  1026.   char *fmt;
  1027.   struct alias_rec *ar;
  1028.   {
  1029. ***************
  1030. *** 345,350 ****
  1031. --- 385,391 ----
  1032.       char *acurr;    /* pointer to current address within "abuf"    */
  1033.       char *anext;    /* pointer to next address within "abuf"    */
  1034.       struct alias_rec *ar0;
  1035. +     int d;        /* dblist index                    */
  1036.   
  1037.       /*
  1038.        * Create a copy of this address we can scribble upon.
  1039. ***************
  1040. *** 358,367 ****
  1041.        * Go through all of the addresses and expand them out.
  1042.        */
  1043.       while ((acurr = next_addr_in_list(&anext)) != NULL) {
  1044. !     if ((ar0 = fetch_alias(db, acurr)) == NULL)
  1045.           ar0 = make_dummy_rec(acurr);
  1046.       if (ar0->type & GROUP)
  1047. !         exp_print_alias(db, fmt, ar0);
  1048.       else
  1049.           print_alias(fmt, ar0);
  1050.       (void) free((malloc_t)ar0);
  1051. --- 399,412 ----
  1052.        * Go through all of the addresses and expand them out.
  1053.        */
  1054.       while ((acurr = next_addr_in_list(&anext)) != NULL) {
  1055. !     for (d = 0 ; dblist[d] != NULL ; ++d) {
  1056. !         if ((ar0 = fetch_alias(dblist[d], acurr)) != NULL)
  1057. !         break;
  1058. !     }
  1059. !     if (ar0 == NULL)
  1060.           ar0 = make_dummy_rec(acurr);
  1061.       if (ar0->type & GROUP)
  1062. !         exp_print_alias(dblist, fmt, ar0);
  1063.       else
  1064.           print_alias(fmt, ar0);
  1065.       (void) free((malloc_t)ar0);
  1066. ***************
  1067. *** 401,407 ****
  1068.            */
  1069.           pfmt[0] = *fmt++;
  1070.           n = 1;
  1071. !         while (strchr("-.0123456789", *fmt) != NULL) {
  1072.           if (n < sizeof(pfmt)-2)
  1073.               pfmt[n++] = *fmt;
  1074.           ++fmt;
  1075. --- 446,452 ----
  1076.            */
  1077.           pfmt[0] = *fmt++;
  1078.           n = 1;
  1079. !         while (index("-.0123456789", *fmt) != NULL) {
  1080.           if (n < sizeof(pfmt)-2)
  1081.               pfmt[n++] = *fmt;
  1082.           ++fmt;
  1083.  
  1084. Index: utils/fastmail.c
  1085. Prereq: 5.7
  1086. *** ../elm2.4/utils/fastmail.c    Sun Jun  6 14:32:10 1993
  1087. --- utils/fastmail.c    Mon Jul 19 22:46:37 1993
  1088. ***************
  1089. *** 1,8 ****
  1090.   
  1091. ! static char rcsid[] = "@(#)$Id: fastmail.c,v 5.7 1993/06/06 18:31:43 syd Exp $";
  1092.   
  1093.   /*******************************************************************************
  1094. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  1095.    *
  1096.    *             Copyright (c) 1988-1992 USENET Community Trust
  1097.    *             Copyright (c) 1986,1987 Dave Taylor
  1098. --- 1,8 ----
  1099.   
  1100. ! static char rcsid[] = "@(#)$Id: fastmail.c,v 5.8 1993/07/20 02:46:36 syd Exp $";
  1101.   
  1102.   /*******************************************************************************
  1103. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  1104.    *
  1105.    *             Copyright (c) 1988-1992 USENET Community Trust
  1106.    *             Copyright (c) 1986,1987 Dave Taylor
  1107. ***************
  1108. *** 14,19 ****
  1109. --- 14,24 ----
  1110.    *
  1111.    *******************************************************************************
  1112.    * $Log: fastmail.c,v $
  1113. +  * Revision 5.8  1993/07/20  02:46:36  syd
  1114. +  * In fastmail, if environment variable $REPLYTO is set, use it as
  1115. +  * default Reply-To.  Also, eliminate unnecessary strlen() calls.
  1116. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  1117. +  *
  1118.    * Revision 5.7  1993/06/06  18:31:43  syd
  1119.    * fix typo
  1120.    *
  1121. ***************
  1122. *** 99,105 ****
  1123.       char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  1124.       char from_addr[SLEN], comments[SLEN], inreplyto[NLEN];
  1125.       char references[SLEN];
  1126. !     char *tmplogname;
  1127.       int  c, sendmail_available, debug = 0;
  1128.   
  1129.       elm_msg_cat = catopen("elm2.4", 0);
  1130. --- 104,110 ----
  1131.       char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  1132.       char from_addr[SLEN], comments[SLEN], inreplyto[NLEN];
  1133.       char references[SLEN];
  1134. !     char *p;
  1135.       int  c, sendmail_available, debug = 0;
  1136.   
  1137.       elm_msg_cat = catopen("elm2.4", 0);
  1138. ***************
  1139. *** 115,120 ****
  1140. --- 120,128 ----
  1141.       inreplyto[0] = '\0';
  1142.       references[0] = '\0';
  1143.   
  1144. +     if ((p = getenv("REPLYTO")) != NULL)
  1145. +       strcpy(replyto, p);
  1146.       while ((c = getopt(argc, argv, "b:c:C:df:F:i:r:R:s:")) != EOF) {
  1147.         switch (c) {
  1148.           case 'b' : strcpy(bcc_list, optarg);        break;
  1149. ***************
  1150. *** 147,159 ****
  1151.       gethostname(hostname, sizeof(hostname));
  1152.   #endif
  1153.   
  1154. !     tmplogname = getlogin();
  1155. !     if (tmplogname != NULL)
  1156. !       strcpy(username, tmplogname);
  1157. !     else
  1158. !       username[0] = '\0';
  1159. !     if (strlen(username) == 0)
  1160.         cuserid(username);
  1161.   
  1162.       if (strcmp(filename, "-")) {
  1163. --- 155,164 ----
  1164.       gethostname(hostname, sizeof(hostname));
  1165.   #endif
  1166.   
  1167. !     username[0] = '\0';
  1168. !     if ((p = getlogin()) != NULL)
  1169. !       strcpy(username, p);
  1170. !     if (!username[0])
  1171.         cuserid(username);
  1172.   
  1173.       if (strcmp(filename, "-")) {
  1174. ***************
  1175. *** 213,237 ****
  1176.   
  1177.       fprintf(tempfile, "Date: %s\n", get_arpa_date());
  1178.   
  1179. !     if (strlen(replyto) > 0)
  1180.         fprintf(tempfile, "Reply-To: %s\n", replyto);
  1181.   
  1182. !     while (optind < argc) 
  1183. !           sprintf(to_list, "%s%s%s", to_list, (strlen(to_list) > 0? ",":""), 
  1184. !           argv[optind++]);
  1185.       
  1186.       fprintf(tempfile, "To: %s\n", to_list);
  1187.   
  1188. !     if (strlen(cc_list) > 0)
  1189.         fprintf(tempfile, "Cc: %s\n", cc_list);
  1190.   
  1191. !     if (strlen(references) > 0)
  1192.         fprintf(tempfile, "References: %s\n", references);
  1193.   
  1194. !     if (strlen(inreplyto) > 0)
  1195.         fprintf(tempfile, "In-Reply-To: %s\n", inreplyto);
  1196.   
  1197. !     if (strlen(comments) > 0)
  1198.         fprintf(tempfile, "Comments: %s\n", comments);
  1199.   
  1200.   #ifndef NO_XHEADER
  1201. --- 218,244 ----
  1202.   
  1203.       fprintf(tempfile, "Date: %s\n", get_arpa_date());
  1204.   
  1205. !     if (replyto[0])
  1206.         fprintf(tempfile, "Reply-To: %s\n", replyto);
  1207.   
  1208. !     while (optind < argc) {
  1209. !       if (to_list[0])
  1210. !         strcat(to_list, ",");
  1211. !       strcat(to_list, argv[optind++]);
  1212. !     }
  1213.       
  1214.       fprintf(tempfile, "To: %s\n", to_list);
  1215.   
  1216. !     if (cc_list[0])
  1217.         fprintf(tempfile, "Cc: %s\n", cc_list);
  1218.   
  1219. !     if (references[0])
  1220.         fprintf(tempfile, "References: %s\n", references);
  1221.   
  1222. !     if (inreplyto[0])
  1223.         fprintf(tempfile, "In-Reply-To: %s\n", inreplyto);
  1224.   
  1225. !     if (comments[0])
  1226.         fprintf(tempfile, "Comments: %s\n", comments);
  1227.   
  1228.   #ifndef NO_XHEADER
  1229. ***************
  1230. *** 248,255 ****
  1231.   
  1232.       if (debug)
  1233.           printf("Mailing to %s%s%s%s%s [via %s]\n", to_list,
  1234. !             (strlen(cc_list) > 0 ? " ":""), cc_list,
  1235. !             (strlen(bcc_list) > 0 ? " ":""), bcc_list,
  1236.               sendmail_available? "sendmail" : "rmail");
  1237.   
  1238.       sprintf(command_buffer, "cat %s %s | %s %s %s %s", 
  1239. --- 255,262 ----
  1240.   
  1241.       if (debug)
  1242.           printf("Mailing to %s%s%s%s%s [via %s]\n", to_list,
  1243. !             (cc_list[0] ? " ":""), cc_list,
  1244. !             (bcc_list[0] ? " ":""), bcc_list,
  1245.               sendmail_available? "sendmail" : "rmail");
  1246.   
  1247.       sprintf(command_buffer, "cat %s %s | %s %s %s %s", 
  1248.  
  1249. Index: utils/newmail.c
  1250. Prereq: 5.18
  1251. *** ../elm2.4/utils/newmail.c    Sun Jun  6 14:24:48 1993
  1252. --- utils/newmail.c    Tue Aug  3 15:29:27 1993
  1253. ***************
  1254. *** 1,8 ****
  1255.   
  1256. ! static char rcsid[] = "@(#)$Id: newmail.c,v 5.18 1993/06/06 18:00:10 syd Exp $";
  1257.   
  1258.   /*******************************************************************************
  1259. !  *  The Elm Mail System  -  $Revision: 5.18 $   $State: Exp $
  1260.    *
  1261.    *             Copyright (c) 1988-1992 USENET Community Trust
  1262.    *             Copyright (c) 1986,1987 Dave Taylor
  1263. --- 1,8 ----
  1264.   
  1265. ! static char rcsid[] = "@(#)$Id: newmail.c,v 5.19 1993/08/03 19:28:39 syd Exp $";
  1266.   
  1267.   /*******************************************************************************
  1268. !  *  The Elm Mail System  -  $Revision: 5.19 $   $State: Exp $
  1269.    *
  1270.    *             Copyright (c) 1988-1992 USENET Community Trust
  1271.    *             Copyright (c) 1986,1987 Dave Taylor
  1272. ***************
  1273. *** 14,19 ****
  1274. --- 14,31 ----
  1275.    *
  1276.    *******************************************************************************
  1277.    * $Log: newmail.c,v $
  1278. +  * Revision 5.19  1993/08/03  19:28:39  syd
  1279. +  * Elm tries to replace the system toupper() and tolower() on current
  1280. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1281. +  * collide during linking with routines in isctype.o.  This patch adds
  1282. +  * a Configure test to determine whether replacements are really needed
  1283. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1284. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1285. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1286. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1287. +  * were dropped.
  1288. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1289. +  *
  1290.    * Revision 5.18  1993/06/06  18:00:10  syd
  1291.    * Fix max folder check, off by one
  1292.    *
  1293. ***************
  1294. *** 143,149 ****
  1295.   **/
  1296.   
  1297.   #include "elmutil.h"
  1298. - #include <ctype.h>
  1299.   #include "s_newmail.h"
  1300.   
  1301.   #ifdef PWDINSYS
  1302. --- 155,160 ----
  1303.  
  1304. Index: utils/prlong.c
  1305. Prereq: 5.2
  1306. *** ../elm2.4/utils/prlong.c    Tue Apr 20 21:41:19 1993
  1307. --- utils/prlong.c    Tue Aug  3 15:29:28 1993
  1308. ***************
  1309. *** 1,8 ****
  1310.   
  1311. ! static char rcsid[] = "@(#)$Id: prlong.c,v 5.2 1993/04/21 01:41:14 syd Exp $";
  1312.   
  1313.   /*******************************************************************************
  1314. !  *  The Elm Mail System  -  $Revision: 5.2 $
  1315.    *
  1316.    *             Copyright (c) 1988-1992 USENET Community Trust
  1317.    *             Copyright (c) 1986,1987 Dave Taylor
  1318. --- 1,8 ----
  1319.   
  1320. ! static char rcsid[] = "@(#)$Id: prlong.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  1321.   
  1322.   /*******************************************************************************
  1323. !  *  The Elm Mail System  -  $Revision: 5.3 $
  1324.    *
  1325.    *             Copyright (c) 1988-1992 USENET Community Trust
  1326.    *             Copyright (c) 1986,1987 Dave Taylor
  1327. ***************
  1328. *** 14,19 ****
  1329. --- 14,31 ----
  1330.    *
  1331.    *******************************************************************************
  1332.    * $Log: prlong.c,v $
  1333. +  * Revision 5.3  1993/08/03  19:28:39  syd
  1334. +  * Elm tries to replace the system toupper() and tolower() on current
  1335. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1336. +  * collide during linking with routines in isctype.o.  This patch adds
  1337. +  * a Configure test to determine whether replacements are really needed
  1338. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1339. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1340. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1341. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1342. +  * were dropped.
  1343. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1344. +  *
  1345.    * Revision 5.2  1993/04/21  01:41:14  syd
  1346.    * Needs ctype.h
  1347.    * From: Syd
  1348. ***************
  1349. *** 61,67 ****
  1350.   
  1351.   
  1352.   #include <stdio.h>
  1353. - #include <ctype.h>
  1354.   #include "defs.h"
  1355.   
  1356.   #define MAXWID        78    /* default maximum line width        */
  1357. --- 73,78 ----
  1358.  
  1359. Index: utils/readmsg.c
  1360. Prereq: 5.9
  1361. *** ../elm2.4/utils/readmsg.c    Tue Apr 20 21:17:52 1993
  1362. --- utils/readmsg.c    Tue Aug  3 15:29:29 1993
  1363. ***************
  1364. *** 1,8 ****
  1365.   
  1366. ! static char rcsid[] = "@(#)$Id: readmsg.c,v 5.9 1993/04/21 01:17:51 syd Exp $";
  1367.   
  1368.   /*******************************************************************************
  1369. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  1370.    *
  1371.    *            Copyright (c) 1988-1992 USENET Community Trust
  1372.    *            Copyright (c) 1986,1987 Dave Taylor
  1373. --- 1,8 ----
  1374.   
  1375. ! static char rcsid[] = "@(#)$Id: readmsg.c,v 5.10 1993/08/03 19:28:39 syd Exp $";
  1376.   
  1377.   /*******************************************************************************
  1378. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1379.    *
  1380.    *            Copyright (c) 1988-1992 USENET Community Trust
  1381.    *            Copyright (c) 1986,1987 Dave Taylor
  1382. ***************
  1383. *** 14,19 ****
  1384. --- 14,31 ----
  1385.    *
  1386.    *******************************************************************************
  1387.    * $Log: readmsg.c,v $
  1388. +  * Revision 5.10  1993/08/03  19:28:39  syd
  1389. +  * Elm tries to replace the system toupper() and tolower() on current
  1390. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1391. +  * collide during linking with routines in isctype.o.  This patch adds
  1392. +  * a Configure test to determine whether replacements are really needed
  1393. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1394. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1395. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1396. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1397. +  * were dropped.
  1398. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1399. +  *
  1400.    * Revision 5.9  1993/04/21  01:17:51  syd
  1401.    * readmsg treated a line with From_ preceeded by whitespace as a valid
  1402.    * message delimiter.
  1403. ***************
  1404. *** 115,121 ****
  1405.   
  1406.   #include "elmutil.h"
  1407.   #include "s_readmsg.h"
  1408. - #include <ctype.h>
  1409.   
  1410.   /** three defines for what level of headers to display **/
  1411.   #define ALL        1
  1412. --- 127,132 ----
  1413.  
  1414. Index: filter/utils.c
  1415. Prereq: 5.3
  1416. *** ../elm2.4/filter/utils.c    Wed Jan 27 14:40:07 1993
  1417. --- filter/utils.c    Tue Aug  3 15:28:42 1993
  1418. ***************
  1419. *** 1,8 ****
  1420.   
  1421. ! static char rcsid[] ="@(#)$Id: utils.c,v 5.3 1993/01/27 19:40:01 syd Exp $";
  1422.   
  1423.   /*******************************************************************************
  1424. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  1425.    *
  1426.    *             Copyright (c) 1988-1992 USENET Community Trust
  1427.    *             Copyright (c) 1986,1987 Dave Taylor
  1428. --- 1,8 ----
  1429.   
  1430. ! static char rcsid[] ="@(#)$Id: utils.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  1431.   
  1432.   /*******************************************************************************
  1433. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  1434.    *
  1435.    *             Copyright (c) 1988-1992 USENET Community Trust
  1436.    *             Copyright (c) 1986,1987 Dave Taylor
  1437. ***************
  1438. *** 14,19 ****
  1439. --- 14,31 ----
  1440.    *
  1441.    *******************************************************************************
  1442.    * $Log: utils.c,v $
  1443. +  * Revision 5.4  1993/08/03  19:28:39  syd
  1444. +  * Elm tries to replace the system toupper() and tolower() on current
  1445. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1446. +  * collide during linking with routines in isctype.o.  This patch adds
  1447. +  * a Configure test to determine whether replacements are really needed
  1448. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1449. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1450. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1451. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1452. +  * were dropped.
  1453. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1454. +  *
  1455.    * Revision 5.3  1993/01/27  19:40:01  syd
  1456.    * I implemented a change to filter's default verbose message format
  1457.    * including %x %X style date and time along with username
  1458. ***************
  1459. *** 36,42 ****
  1460.   
  1461.   #include <stdio.h>
  1462.   #include <pwd.h>
  1463. - #include <ctype.h>
  1464.   #include <fcntl.h>
  1465.   
  1466.   #include "defs.h"
  1467. --- 48,53 ----
  1468. ***************
  1469. *** 187,194 ****
  1470.       register int i = 0, j = 0;
  1471.   
  1472.       while (str[i] != '\0') {
  1473. !       while ((isupper(str[i]) ? tolower(str[i]) : str[i]) ==
  1474. !          (isupper(pat[j]) ? tolower(pat[j]) : pat[j])) {
  1475.           i++; j++;
  1476.           if (pat[j] == '\0') 
  1477.             return(TRUE);
  1478. --- 198,204 ----
  1479.       register int i = 0, j = 0;
  1480.   
  1481.       while (str[i] != '\0') {
  1482. !       while (tolower(str[i]) == tolower(pat[j])) {
  1483.           i++; j++;
  1484.           if (pat[j] == '\0') 
  1485.             return(TRUE);
  1486.  
  1487. Index: filter/regexp.c
  1488. Prereq: 5.6
  1489. *** ../elm2.4/filter/regexp.c    Thu Dec 10 20:45:26 1992
  1490. --- filter/regexp.c    Wed Jun  9 23:12:16 1993
  1491. ***************
  1492. *** 1,8 ****
  1493.   
  1494. ! /* $Id: regexp.c,v 5.6 1992/12/11 01:45:04 syd Exp $ */
  1495.   
  1496.   /*******************************************************************************
  1497. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  1498.    *
  1499.    *             Copyright (c) 1992 USENET Community Trust
  1500.    *******************************************************************************
  1501. --- 1,8 ----
  1502.   
  1503. ! static char rcsid[] = "@(#)$Id: regexp.c,v 5.7 1993/06/10 03:12:10 syd Exp $";
  1504.   
  1505.   /*******************************************************************************
  1506. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  1507.    *
  1508.    *             Copyright (c) 1992 USENET Community Trust
  1509.    *******************************************************************************
  1510. ***************
  1511. *** 13,18 ****
  1512. --- 13,22 ----
  1513.    *
  1514.    *******************************************************************************
  1515.    * $Log: regexp.c,v $
  1516. +  * Revision 5.7  1993/06/10  03:12:10  syd
  1517. +  * Add missing rcs id lines
  1518. +  * From: Syd
  1519. +  *
  1520.    * Revision 5.6  1992/12/11  01:45:04  syd
  1521.    * remove sys/types.h include, it is now included by defs.h
  1522.    * and this routine includes defs.h or indirectly includes defs.h
  1523.  
  1524. Index: filter/rules.c
  1525. Prereq: 5.7
  1526. *** ../elm2.4/filter/rules.c    Wed Jan 27 14:45:16 1993
  1527. --- filter/rules.c    Tue Aug  3 15:28:42 1993
  1528. ***************
  1529. *** 1,8 ****
  1530.   
  1531. ! static char rcsid[] ="@(#)$Id: rules.c,v 5.7 1993/01/27 19:45:15 syd Exp $";
  1532.   
  1533.   /*******************************************************************************
  1534. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  1535.    *
  1536.    *             Copyright (c) 1988-1992 USENET Community Trust
  1537.    *             Copyright (c) 1986,1987 Dave Taylor
  1538. --- 1,8 ----
  1539.   
  1540. ! static char rcsid[] ="@(#)$Id: rules.c,v 5.8 1993/08/03 19:28:39 syd Exp $";
  1541.   
  1542.   /*******************************************************************************
  1543. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  1544.    *
  1545.    *             Copyright (c) 1988-1992 USENET Community Trust
  1546.    *             Copyright (c) 1986,1987 Dave Taylor
  1547. ***************
  1548. *** 14,19 ****
  1549. --- 14,31 ----
  1550.    *
  1551.    *******************************************************************************
  1552.    * $Log: rules.c,v $
  1553. +  * Revision 5.8  1993/08/03  19:28:39  syd
  1554. +  * Elm tries to replace the system toupper() and tolower() on current
  1555. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1556. +  * collide during linking with routines in isctype.o.  This patch adds
  1557. +  * a Configure test to determine whether replacements are really needed
  1558. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1559. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1560. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1561. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1562. +  * were dropped.
  1563. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1564. +  *
  1565.    * Revision 5.7  1993/01/27  19:45:15  syd
  1566.    * Filter turns spaces in quoted strings into _ and then back again. This destroys
  1567.    * any _ that where there in the first place. This patch removes that.
  1568. ***************
  1569. *** 65,71 ****
  1570.   #include <stdio.h>
  1571.   #include "defs.h"
  1572.   #include <pwd.h>
  1573. - #include <ctype.h>
  1574.   #ifdef I_TIME
  1575.   #  include <time.h>
  1576.   #endif
  1577. --- 77,82 ----
  1578.  
  1579. Index: lib/mk_aliases.c
  1580. Prereq: 5.12
  1581. *** ../elm2.4/lib/mk_aliases.c    Sat May  8 16:25:34 1993
  1582. --- lib/mk_aliases.c    Tue Aug  3 15:28:53 1993
  1583. ***************
  1584. *** 1,8 ****
  1585.   
  1586. ! static char rcsid[] = "@(#)$Id: mk_aliases.c,v 5.12 1993/05/08 20:25:33 syd Exp $";
  1587.   
  1588.   /*******************************************************************************
  1589. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  1590.    *
  1591.    *            Copyright (c) 1988-1992 USENET Community Trust
  1592.    *            Copyright (c) 1986,1987 Dave Taylor
  1593. --- 1,8 ----
  1594.   
  1595. ! static char rcsid[] = "@(#)$Id: mk_aliases.c,v 5.15 1993/08/03 19:28:39 syd Exp $";
  1596.   
  1597.   /*******************************************************************************
  1598. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  1599.    *
  1600.    *            Copyright (c) 1988-1992 USENET Community Trust
  1601.    *            Copyright (c) 1986,1987 Dave Taylor
  1602. ***************
  1603. *** 14,19 ****
  1604. --- 14,40 ----
  1605.    *
  1606.    *******************************************************************************
  1607.    * $Log: mk_aliases.c,v $
  1608. +  * Revision 5.15  1993/08/03  19:28:39  syd
  1609. +  * Elm tries to replace the system toupper() and tolower() on current
  1610. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1611. +  * collide during linking with routines in isctype.o.  This patch adds
  1612. +  * a Configure test to determine whether replacements are really needed
  1613. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1614. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1615. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1616. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1617. +  * were dropped.
  1618. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1619. +  *
  1620. +  * Revision 5.14  1993/07/20  02:59:53  syd
  1621. +  * Support aliases both on 64 bit and 32 bit machines at the same time.
  1622. +  * From: Dan Mosedale <mosedale@genome.stanford.edu>
  1623. +  *
  1624. +  * Revision 5.13  1993/07/20  01:45:56  syd
  1625. +  * When resyncing aliases from elm, and there was aliases to delete,
  1626. +  * the alias.pag file could be corrupted since file_offset wasn't set to zero.
  1627. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1628. +  *
  1629.    * Revision 5.12  1993/05/08  20:25:33  syd
  1630.    * Add sleepmsg to control transient message delays
  1631.    * From: Syd
  1632. ***************
  1633. *** 110,122 ****
  1634.   
  1635.   #include "headers.h"
  1636.   #include "s_newalias.h"
  1637. - #include <ctype.h>
  1638.   #include "ndbz.h"
  1639.   
  1640.   #ifdef BSD
  1641.   #  include <sys/file.h>
  1642. - #  undef tolower
  1643. - #  undef toupper
  1644.   #endif
  1645.   
  1646.   #define group(string)        (index(string,',') != NULL)
  1647. --- 131,140 ----
  1648. ***************
  1649. *** 278,287 ****
  1650.   int
  1651.   add_to_hash_table(word, offset)
  1652.   char *word;
  1653. ! long  offset;
  1654.   {
  1655.       datum    key, value, ovalue;
  1656. !     long    off;
  1657.       
  1658.       key.dptr = word;
  1659.       key.dsize = strlen(word);
  1660. --- 296,305 ----
  1661.   int
  1662.   add_to_hash_table(word, offset)
  1663.   char *word;
  1664. ! int32  offset;
  1665.   {
  1666.       datum    key, value, ovalue;
  1667. !     int32    off;
  1668.       
  1669.       key.dptr = word;
  1670.       key.dsize = strlen(word);
  1671. ***************
  1672. *** 320,326 ****
  1673.   FILE *data;
  1674.   register char *aliases, *lastn, *firstn, *comment, *addresses;
  1675.   {
  1676. !     struct alias_rec    alias;
  1677.       register char    *s;
  1678.   /*
  1679.    *    crack the information into an alias_rec structure, then add the entry
  1680. --- 338,344 ----
  1681.   FILE *data;
  1682.   register char *aliases, *lastn, *firstn, *comment, *addresses;
  1683.   {
  1684. !     struct alias_disk_rec    alias;
  1685.       register char    *s;
  1686.   /*
  1687.    *    crack the information into an alias_rec structure, then add the entry
  1688. ***************
  1689. *** 357,363 ****
  1690.        *  Only add an entry if we could add it to the hash table.
  1691.        *  (no errors or duplicates)
  1692.        */
  1693. !         if (add_to_hash_table(aliases, file_offset+sizeof(alias)) == 0) {
  1694.               file_offset += alias.length + sizeof(alias);
  1695.           /*
  1696.            *  Write the entry to the data file, followed by its data
  1697. --- 375,382 ----
  1698.        *  Only add an entry if we could add it to the hash table.
  1699.        *  (no errors or duplicates)
  1700.        */
  1701. !         if (add_to_hash_table(aliases, (int32)(file_offset+sizeof(alias)))
  1702. !         == 0) {
  1703.               file_offset += alias.length + sizeof(alias);
  1704.           /*
  1705.            *  Write the entry to the data file, followed by its data
  1706. ***************
  1707. *** 714,719 ****
  1708. --- 733,739 ----
  1709.       buff_loaded = 0;     /* file buffer empty right now! */
  1710.       al_count = 0;
  1711.       err_flag = 0;
  1712. +     file_offset = 0;
  1713.   
  1714.       while (get_alias(in, fromelm) != -1) {
  1715.           put_alias(data);
  1716.  
  1717. Index: lib/msgcat.c
  1718. *** ../elm2.4/lib/msgcat.c    Sun Apr 11 23:22:31 1993
  1719. --- lib/msgcat.c    Wed Jun  9 23:12:20 1993
  1720. ***************
  1721. *** 1,3 ****
  1722. --- 1,6 ----
  1723. + static char rcsid[] = "@(#)$Id: msgcat.c,v 5.2 1993/06/10 03:12:10 syd Exp $";
  1724.   /* -*- c++ -*- */
  1725.   
  1726.   /***********************************************************
  1727.  
  1728. Index: src/curses.c
  1729. Prereq: 5.10
  1730. *** ../elm2.4/src/curses.c    Sun Apr 11 23:57:46 1993
  1731. --- src/curses.c    Sun Aug 22 22:56:36 1993
  1732. ***************
  1733. *** 1,8 ****
  1734.   
  1735. ! static char rcsid[] = "@(#)$Id: curses.c,v 5.10 1993/04/12 03:57:45 syd Exp $";
  1736.   
  1737.   /*******************************************************************************
  1738. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1739.    *
  1740.    *             Copyright (c) 1988-1992 USENET Community Trust
  1741.    *             Copyright (c) 1986,1987 Dave Taylor
  1742. --- 1,8 ----
  1743.   
  1744. ! static char rcsid[] = "@(#)$Id: curses.c,v 5.13 1993/08/23 02:56:35 syd Exp $";
  1745.   
  1746.   /*******************************************************************************
  1747. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  1748.    *
  1749.    *             Copyright (c) 1988-1992 USENET Community Trust
  1750.    *             Copyright (c) 1986,1987 Dave Taylor
  1751. ***************
  1752. *** 14,19 ****
  1753. --- 14,42 ----
  1754.    *
  1755.    *******************************************************************************
  1756.    * $Log: curses.c,v $
  1757. +  * Revision 5.13  1993/08/23  02:56:35  syd
  1758. +  * have Writechar() backspace over the left edge of the screen to the end
  1759. +  * of the previous line if the current line is not the first line on the
  1760. +  * screen.
  1761. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1762. +  *
  1763. +  * Revision 5.12  1993/08/03  19:28:39  syd
  1764. +  * Elm tries to replace the system toupper() and tolower() on current
  1765. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1766. +  * collide during linking with routines in isctype.o.  This patch adds
  1767. +  * a Configure test to determine whether replacements are really needed
  1768. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1769. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1770. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1771. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1772. +  * were dropped.
  1773. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1774. +  *
  1775. +  * Revision 5.11  1993/07/20  02:13:20  syd
  1776. +  * Make tabspacing check for <= 0 so we dont get divide by
  1777. +  * zero errors when the termcap has tabspacing 0
  1778. +  * From: Syd via request from G A Smant
  1779. +  *
  1780.    * Revision 5.10  1993/04/12  03:57:45  syd
  1781.    * Give up and add an Ultrix specific patch. There is a bug in Ispell under
  1782.    * ultrix.  The problem is that when ispell returns, the terminal is no
  1783. ***************
  1784. *** 90,106 ****
  1785.   # endif
  1786.   #endif
  1787.   
  1788. - #include <ctype.h>
  1789.   #ifdef PTEM
  1790.   #  include <sys/stream.h>
  1791.   #  include <sys/ptem.h>
  1792.   #endif
  1793.   
  1794. - #ifdef BSD
  1795. - #undef tolower
  1796. - #endif
  1797.   #define TTYIN    0
  1798.   
  1799.   #ifdef SHORTNAMES
  1800. --- 113,123 ----
  1801. ***************
  1802. *** 202,208 ****
  1803.       _cleartoeos        = tgetstr("cd", &ptr);
  1804.       _lines                 = tgetnum("li");
  1805.       _columns       = tgetnum("co");
  1806. !     tabspacing       = ((tabspacing=tgetnum("it"))==-1 ? 8 : tabspacing);
  1807.       _automargin       = tgetflag("am");
  1808.       _eatnewlineglitch   = tgetflag("xn");
  1809.       _transmit_on       = tgetstr("ks", &ptr);
  1810. --- 219,225 ----
  1811.       _cleartoeos        = tgetstr("cd", &ptr);
  1812.       _lines                 = tgetnum("li");
  1813.       _columns       = tgetnum("co");
  1814. !     tabspacing       = ((tabspacing=tgetnum("it"))<= 0 ? 8 : tabspacing);
  1815.       _automargin       = tgetflag("am");
  1816.       _eatnewlineglitch   = tgetflag("xn");
  1817.       _transmit_on       = tgetstr("ks", &ptr);
  1818. ***************
  1819. *** 706,715 ****
  1820.   
  1821.       /* if backspace, move back  one space  if not already in column 0 */
  1822.       else if (ch == BACKSPACE) {
  1823. !       if(_col != 0) {
  1824. !         tputs(_left, 1, outchar);
  1825. !         _col--;
  1826. !       } /* else BACKSPACE does nothing */
  1827.       }
  1828.   
  1829.       /* if bell, ring the bell but don't advance the column */
  1830. --- 723,738 ----
  1831.   
  1832.       /* if backspace, move back  one space  if not already in column 0 */
  1833.       else if (ch == BACKSPACE) {
  1834. !         if (_col != 0) {
  1835. !         tputs(_left, 1, outchar);
  1836. !         _col--;
  1837. !         }
  1838. !         else if (_line > 0) {
  1839. !         _col = COLUMNS - 1;
  1840. !         _line--;
  1841. !         moveabsolute (_col, _line);
  1842. !         }
  1843. !         /* else BACKSPACE does nothing */
  1844.       }
  1845.   
  1846.       /* if bell, ring the bell but don't advance the column */
  1847.  
  1848. Index: src/date.c
  1849. Prereq: 5.4
  1850. *** ../elm2.4/src/date.c    Thu Dec 10 20:45:32 1992
  1851. --- src/date.c    Tue Aug  3 15:29:03 1993
  1852. ***************
  1853. *** 1,8 ****
  1854.   
  1855. ! static char rcsid[] = "@(#)$Id: date.c,v 5.4 1992/12/11 01:45:04 syd Exp $";
  1856.   
  1857.   /*******************************************************************************
  1858. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  1859.    *
  1860.    *             Copyright (c) 1988-1992 USENET Community Trust
  1861.    *             Copyright (c) 1986,1987 Dave Taylor
  1862. --- 1,8 ----
  1863.   
  1864. ! static char rcsid[] = "@(#)$Id: date.c,v 5.5 1993/08/03 19:28:39 syd Exp $";
  1865.   
  1866.   /*******************************************************************************
  1867. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  1868.    *
  1869.    *             Copyright (c) 1988-1992 USENET Community Trust
  1870.    *             Copyright (c) 1986,1987 Dave Taylor
  1871. ***************
  1872. *** 14,19 ****
  1873. --- 14,31 ----
  1874.    *
  1875.    *******************************************************************************
  1876.    * $Log: date.c,v $
  1877. +  * Revision 5.5  1993/08/03  19:28:39  syd
  1878. +  * Elm tries to replace the system toupper() and tolower() on current
  1879. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1880. +  * collide during linking with routines in isctype.o.  This patch adds
  1881. +  * a Configure test to determine whether replacements are really needed
  1882. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1883. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1884. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1885. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1886. +  * were dropped.
  1887. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1888. +  *
  1889.    * Revision 5.4  1992/12/11  01:45:04  syd
  1890.    * remove sys/types.h include, it is now included by defs.h
  1891.    * and this routine includes defs.h or indirectly includes defs.h
  1892. ***************
  1893. *** 49,65 ****
  1894.   #  include <sys/timeb.h>
  1895.   #endif
  1896.   
  1897. - #include <ctype.h>
  1898.   #ifndef    _POSIX_SOURCE
  1899.   extern struct tm *localtime();
  1900.   extern struct tm *gmtime();
  1901.   extern time_t      time();
  1902.   #endif
  1903. - #ifdef BSD
  1904. - #undef tolower
  1905. - #endif
  1906.   
  1907.   #define MONTHS_IN_YEAR    11    /* 0-11 equals 12 months! */
  1908.   #define FEB         1    /* 0 = January           */
  1909. --- 61,71 ----
  1910.  
  1911. Index: src/editmsg.c
  1912. Prereq: 5.12
  1913. *** ../elm2.4/src/editmsg.c    Sat May  8 16:25:38 1993
  1914. --- src/editmsg.c    Sun Sep 26 21:51:57 1993
  1915. ***************
  1916. *** 1,8 ****
  1917.   
  1918. ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.12 1993/05/08 20:25:33 syd Exp $";
  1919.   
  1920.   /*******************************************************************************
  1921. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  1922.    *
  1923.    *             Copyright (c) 1988-1992 USENET Community Trust
  1924.    *            Copyright (c) 1986,1987 Dave Taylor
  1925. --- 1,8 ----
  1926.   
  1927. ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.19 1993/09/27 01:51:38 syd Exp $";
  1928.   
  1929.   /*******************************************************************************
  1930. !  *  The Elm Mail System  -  $Revision: 5.19 $   $State: Exp $
  1931.    *
  1932.    *             Copyright (c) 1988-1992 USENET Community Trust
  1933.    *            Copyright (c) 1986,1987 Dave Taylor
  1934. ***************
  1935. *** 14,19 ****
  1936. --- 14,86 ----
  1937.    *
  1938.    *******************************************************************************
  1939.    * $Log: editmsg.c,v $
  1940. +  * Revision 5.19  1993/09/27  01:51:38  syd
  1941. +  * Add elm_chown to consolidate for Xenix not allowing -1
  1942. +  * From: Syd
  1943. +  *
  1944. +  * Revision 5.18  1993/08/23  03:26:24  syd
  1945. +  * Try setting group id separate from user id in chown to
  1946. +  * allow restricted systems to change group id of file
  1947. +  * From: Syd
  1948. +  *
  1949. +  * Revision 5.17  1993/08/23  02:55:38  syd
  1950. +  * Fix problem where deleting to previous line caused duplication due to the
  1951. +  * file being opened for append (in append mode, all writes are to the end of
  1952. +  * file regardless of the file pointer).
  1953. +  * From: pdc@lunch.asd.sgi.com (Paul Close)
  1954. +  *
  1955. +  * Revision 5.16  1993/08/03  20:12:46  syd
  1956. +  * Fix signal type for 386bsd
  1957. +  * From: Scott Mace <smace@freefall.cdrom.com>
  1958. +  *
  1959. +  * Revision 5.15  1993/08/03  19:28:39  syd
  1960. +  * Elm tries to replace the system toupper() and tolower() on current
  1961. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1962. +  * collide during linking with routines in isctype.o.  This patch adds
  1963. +  * a Configure test to determine whether replacements are really needed
  1964. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1965. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1966. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1967. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1968. +  * were dropped.
  1969. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1970. +  *
  1971. +  * Revision 5.14  1993/07/20  02:41:24  syd
  1972. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  1973. +  * have it return an error code instead of bailing out, and add a buffer
  1974. +  * size argument to avoid overwritting the destination.  The first is to
  1975. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  1976. +  * forgot to go through) to protect the value handed to expand_env().
  1977. +  * The second is because expand_env() was originally written to support
  1978. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  1979. +  * in the other places where it has since been used.  The third is just
  1980. +  * a matter of practicing safe source code.
  1981. +  *
  1982. +  * This patch changes all invocations to expand_env() to eliminate making
  1983. +  * temporary copies (now that the routine is non-destructive) and to pass
  1984. +  * in a destination length.  Since expand_env() no longer bails out on
  1985. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  1986. +  * this.  Moreover, the error message now gives some indication of what
  1987. +  * the problem is rather than just saying "can't expand".
  1988. +  *
  1989. +  * Gratitous change to src/editmsg.c renaming filename variables to
  1990. +  * clarify the purpose.
  1991. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1992. +  *
  1993. +  * Revision 5.13  1993/06/10  03:07:39  syd
  1994. +  * This fixes a bug in the MIME code.  Include_Part() uses expand_env()
  1995. +  * to expand the include file name, but since expand_env() is destructive
  1996. +  * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
  1997. +  * header can contain a bogus value.  The easy fix would be a one-line
  1998. +  * hack to Include_Part to use a temporary buffer.  This patch does not
  1999. +  * implement the easy fix.  *Every* place expand_env() is used, its side
  2000. +  * effects cause problems.  I think the right fix is to make expand_env()
  2001. +  * non-destructive (i.e. have it duplicate the input to a temporary buffer
  2002. +  * and work from there).  The attached patch modifies expand_env() in
  2003. +  * that manner, and eliminates all of the `copy to a temporary buffer'
  2004. +  * calls that precede it throughout elm.
  2005. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2006. +  *
  2007.    * Revision 5.12  1993/05/08  20:25:33  syd
  2008.    * Add sleepmsg to control transient message delays
  2009.    * From: Syd
  2010. ***************
  2011. *** 81,89 ****
  2012.   /* BSD has already included setjmp.h in headers.h */
  2013.   #include <setjmp.h>
  2014.   #endif /* BSD */
  2015. - #include <ctype.h>
  2016.   
  2017. ! #ifdef POSIX_SIGNALS
  2018.   # define JMP_BUF        sigjmp_buf
  2019.   # define SETJMP(env)        sigsetjmp((env), 1)
  2020.   # define LONGJMP(env,val)    siglongjmp((env), (val))
  2021. --- 148,155 ----
  2022.   /* BSD has already included setjmp.h in headers.h */
  2023.   #include <setjmp.h>
  2024.   #endif /* BSD */
  2025.   
  2026. ! #if defined(POSIX_SIGNALS) && !defined(__386BSD__)
  2027.   # define JMP_BUF        sigjmp_buf
  2028.   # define SETJMP(env)        sigsetjmp((env), 1)
  2029.   # define LONGJMP(env,val)    siglongjmp((env), (val))
  2030. ***************
  2031. *** 93,102 ****
  2032.   # define LONGJMP(env,val)    longjmp((env), (val))
  2033.   #endif
  2034.   
  2035. - #ifdef BSD
  2036. - #undef        tolower
  2037. - #endif
  2038.   char *error_description(), *format_long(), *strip_commas();
  2039.   long  fsize();
  2040.   
  2041. --- 159,164 ----
  2042. ***************
  2043. *** 202,228 ****
  2044.           of lines and characters we added, if any... **/
  2045.   
  2046.       FILE *myfd;
  2047. !     char myfname[SLEN], buffer[SLEN];
  2048.       register int n;
  2049.       register int lines = 0, nchars = 0;
  2050.   
  2051. !     for ( n = 0 ; whitespace(filename[n]) ; n++ );
  2052.   
  2053. !     /** expand any shell variables, '~' or other notation... **/
  2054. !     /* temp copy of filename to buffer since expand_env is destructive */
  2055. !     strcpy(buffer, &filename[n]);
  2056. !     expand_env(myfname, buffer);
  2057.   
  2058. !     if (strlen(myfname) == 0) {
  2059.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoFilenameSpecified,
  2060.             "\n\r(No filename specified for file read! Continue.)\n\r"), 0);
  2061.         return;
  2062.       }
  2063.   
  2064. !     if ((myfd = fopen(myfname,"r")) == NULL) {
  2065.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCouldntReadFile,
  2066. !         "\n\r(Couldn't read file '%s'! Continue.)\n\r"), 1,
  2067. !          myfname);
  2068.         return;
  2069.       }
  2070.   
  2071. --- 264,288 ----
  2072.           of lines and characters we added, if any... **/
  2073.   
  2074.       FILE *myfd;
  2075. !     char exp_fname[SLEN], buffer[SLEN];
  2076.       register int n;
  2077.       register int lines = 0, nchars = 0;
  2078.   
  2079. !     while (whitespace(*filename))
  2080. !         ++filename;
  2081.   
  2082. !     /** expand any shell variables or leading '~' **/
  2083. !     (void) expand_env(exp_fname, filename, sizeof(exp_fname));
  2084.   
  2085. !     if (exp_fname[0] == '\0') {
  2086.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoFilenameSpecified,
  2087.             "\n\r(No filename specified for file read! Continue.)\n\r"), 0);
  2088.         return;
  2089.       }
  2090.   
  2091. !     if ((myfd = fopen(exp_fname,"r")) == NULL) {
  2092.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCouldntReadFile,
  2093. !         "\n\r(Couldn't read file '%s'! Continue.)\n\r"), 1, exp_fname);
  2094.         return;
  2095.       }
  2096.   
  2097. ***************
  2098. *** 251,257 ****
  2099.   
  2100.       if (show_user_filename)
  2101.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmAddedFromFile,
  2102. !         "from file %s. Continue.)\n\r"), 1, myfname);
  2103.       else
  2104.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmAddedToMessage,
  2105.           "to message. Continue.)\n\r"), 0);
  2106. --- 311,317 ----
  2107.   
  2108.       if (show_user_filename)
  2109.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmAddedFromFile,
  2110. !         "from file %s. Continue.)\n\r"), 1, exp_fname);
  2111.       else
  2112.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmAddedToMessage,
  2113.           "to message. Continue.)\n\r"), 0);
  2114. ***************
  2115. *** 542,548 ****
  2116.           sprintf(buffer, "%s %s", editor, filename);
  2117.       }
  2118.   
  2119. !     chown(filename, userid, groupid);    /* file was owned by root! */
  2120.   
  2121.       if (( old_raw = RawState()) == ON)
  2122.         Raw(OFF);
  2123. --- 602,608 ----
  2124.           sprintf(buffer, "%s %s", editor, filename);
  2125.       }
  2126.   
  2127. !     (void) elm_chown(filename, userid, groupid);
  2128.   
  2129.       if (( old_raw = RawState()) == ON)
  2130.         Raw(OFF);
  2131. ***************
  2132. *** 610,619 ****
  2133.             "(Continue entering message.  Type ^D or '.' on a line by itself to end.)\n\r");
  2134.       }
  2135.   
  2136. !     if ((edit_fd = fopen(filename, "a+")) == NULL) {
  2137.         err = errno;
  2138.         sprintf(buffer, catgets(elm_msg_cat, ElmSet, ElmCouldntOpenAppend,
  2139. !         "Couldn't open %s for appending [%s]."),
  2140.           filename, error_description(err));
  2141.         Write_to_screen(buffer, 0);
  2142.         dprint(1, (debugfile,
  2143. --- 670,679 ----
  2144.             "(Continue entering message.  Type ^D or '.' on a line by itself to end.)\n\r");
  2145.       }
  2146.   
  2147. !     if ((edit_fd = fopen(filename, "r+")) == NULL) {
  2148.         err = errno;
  2149.         sprintf(buffer, catgets(elm_msg_cat, ElmSet, ElmCouldntOpenAppend,
  2150. !         "Couldn't open %s for update [%s]."),
  2151.           filename, error_description(err));
  2152.         Write_to_screen(buffer, 0);
  2153.         dprint(1, (debugfile,
  2154. ***************
  2155. *** 622,627 ****
  2156. --- 682,690 ----
  2157.         return(1);
  2158.       }
  2159.   
  2160. +     /* Skip past any existing text */
  2161. +     fseek(edit_fd, 0, SEEK_END);
  2162.       /** is there already text in this file? **/
  2163.   
  2164.       if (fsize(edit_fd) > 0L)
  2165.  
  2166. Index: src/reply.c
  2167. Prereq: 5.12
  2168. *** ../elm2.4/src/reply.c    Sun Apr 11 23:02:06 1993
  2169. --- src/reply.c    Tue Aug  3 15:29:18 1993
  2170. ***************
  2171. *** 1,8 ****
  2172.   
  2173. ! static char rcsid[] = "@(#)$Id: reply.c,v 5.12 1993/04/12 03:02:05 syd Exp $";
  2174.   
  2175.   /*******************************************************************************
  2176. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  2177.    *
  2178.    *            Copyright (c) 1988-1992 USENET Community Trust
  2179.    *            Copyright (c) 1986,1987 Dave Taylor
  2180. --- 1,8 ----
  2181.   
  2182. ! static char rcsid[] = "@(#)$Id: reply.c,v 5.15 1993/08/03 19:28:39 syd Exp $";
  2183.   
  2184.   /*******************************************************************************
  2185. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  2186.    *
  2187.    *            Copyright (c) 1988-1992 USENET Community Trust
  2188.    *            Copyright (c) 1986,1987 Dave Taylor
  2189. ***************
  2190. *** 14,19 ****
  2191. --- 14,56 ----
  2192.    *
  2193.    *******************************************************************************
  2194.    * $Log: reply.c,v $
  2195. +  * Revision 5.15  1993/08/03  19:28:39  syd
  2196. +  * Elm tries to replace the system toupper() and tolower() on current
  2197. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2198. +  * collide during linking with routines in isctype.o.  This patch adds
  2199. +  * a Configure test to determine whether replacements are really needed
  2200. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2201. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2202. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2203. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2204. +  * were dropped.
  2205. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2206. +  *
  2207. +  * Revision 5.14  1993/07/20  02:05:17  syd
  2208. +  * A long-standing bug of handling replies to VMS systems.
  2209. +  * Original "From: " -line is of format:
  2210. +  *     From: "NAME \"Real Name\"" <USERNAME@vms-system>
  2211. +  * (PMDF mailer)
  2212. +  *     Anyway,  parse_arpa_who()  strips quotes too cleanly
  2213. +  * resulting data:
  2214. +  *     NAME \"Real Name\
  2215. +  * which, when put into parenthesis, becomes:
  2216. +  *     (NAME \"Real Name\)
  2217. +  * which in its turn lacks closing `)'
  2218. +  * Patch of  lib/parsarpwho.c  fixes that.
  2219. +  * strtokq() started one position too late to search for next double-quote (") char.
  2220. +  * Another one-off (chops off trailing comment character, quote or not..)  in   src/reply.c
  2221. +  * From:    Matti Aarnio <mea@utu.fi>
  2222. +  *
  2223. +  * Revision 5.13  1993/06/10  03:02:46  syd
  2224. +  * break_down_tolist() tried to blindly split address lists at "," which
  2225. +  * caused bogus results with addreses that had a comma inside a comment
  2226. +  * or quoted text, such as "user@domain (Last, First)".  This patch steps
  2227. +  * through the address in quanta of RFC-822 tokens when searching for a
  2228. +  * delimiting comma.  It also adds "rfc822_toklen()" to the library to
  2229. +  * get that length.
  2230. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2231. +  *
  2232.    * Revision 5.12  1993/04/12  03:02:05  syd
  2233.    * If a To: or Cc: line is split in a comment, that is between ( and ),
  2234.    * get_and_expand_everyone won't parse that correctly.
  2235. ***************
  2236. *** 79,89 ****
  2237.   #include "headers.h"
  2238.   #include "s_elm.h"
  2239.   #include <errno.h>
  2240. - #include <ctype.h>
  2241. - #ifdef BSD
  2242. - #undef        tolower
  2243. - #endif
  2244.   
  2245.   /** Note that this routine generates automatic header information
  2246.       for the subject and (obviously) to lines, but that these can
  2247. --- 116,121 ----
  2248. ***************
  2249. *** 609,619 ****
  2250.           buffer[loc++] = buf[(*iindex)++]; /* Copy final " */
  2251.       }
  2252.   
  2253. !     while (buf[*iindex] != ',' && buf[*iindex] != '\0')
  2254. !       buffer[loc++] = buf[(*iindex)++];
  2255. !     (*iindex)++;
  2256.       buffer[loc] = '\0';
  2257.   
  2258.       while (whitespace(buffer[loc]))     /* remove trailing whitespace */
  2259. --- 641,664 ----
  2260.           buffer[loc++] = buf[(*iindex)++]; /* Copy final " */
  2261.       }
  2262.   
  2263. !     /*
  2264. !      * Previously, we just went looking for a "," to seperate the
  2265. !      * addresses.  This meant that addresses like:
  2266. !      *
  2267. !      *    joe@acme.com (LastName, Firstname)
  2268. !      *
  2269. !      * got split right down the middle.  The following was changed
  2270. !      * to step through the address in quanta of RFC-822 tokens.
  2271. !      * That fixes the bug, but this routine is still incurably ugly.
  2272. !      */
  2273. !     i = *iindex;
  2274. !     while (buf[i] != ',' && buf[i] != '\0') {
  2275. !         len = rfc822_toklen(buf+i);
  2276. !         strncpy(buffer+loc, buf+i, len);
  2277. !         loc += len;
  2278. !         i += len;
  2279. !     }
  2280. !     *iindex = i + (buf[i] != '\0' ? 1 : 0);
  2281.       buffer[loc] = '\0';
  2282.   
  2283.       while (whitespace(buffer[loc]))     /* remove trailing whitespace */
  2284. ***************
  2285. *** 649,659 ****
  2286.         for (loc = 0, len = strlen(buffer);buffer[loc] != '<' && loc < len; loc++)
  2287.           /* get to the opening comment character... */ ;
  2288.         while (whitespace(buffer[loc])) loc--;    /* back up */
  2289.   
  2290.         /** get the comment field... **/
  2291.   
  2292.         comment[0] = '(';
  2293. !       for (i=1; i < loc; i++)
  2294.           comment[i] = buffer[i-1];
  2295.         comment[i++] = ')';
  2296.         comment[i] = '\0';
  2297. --- 694,705 ----
  2298.         for (loc = 0, len = strlen(buffer);buffer[loc] != '<' && loc < len; loc++)
  2299.           /* get to the opening comment character... */ ;
  2300.         while (whitespace(buffer[loc])) loc--;    /* back up */
  2301. +       if (loc >= 0 && !whitespace(buffer[loc])) loc++; /* And fwd again! */
  2302.   
  2303.         /** get the comment field... **/
  2304.   
  2305.         comment[0] = '(';
  2306. !       for (i=1; i <= loc; i++)
  2307.           comment[i] = buffer[i-1];
  2308.         comment[i++] = ')';
  2309.         comment[i] = '\0';
  2310.  
  2311. Index: src/save_opts.c
  2312. Prereq: 5.2
  2313. *** ../elm2.4/src/save_opts.c    Sun Apr 11 23:10:54 1993
  2314. --- src/save_opts.c    Sun Sep 26 21:52:08 1993
  2315. ***************
  2316. *** 1,8 ****
  2317.   
  2318. ! static char rcsid[] = "@(#)$Id: save_opts.c,v 5.2 1993/04/12 03:10:54 syd Exp $";
  2319.   
  2320.   /*******************************************************************************
  2321. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  2322.    *
  2323.    *            Copyright (c) 1988-1992 USENET Community Trust
  2324.    *            Copyright (c) 1986,1987 Dave Taylor
  2325. --- 1,8 ----
  2326.   
  2327. ! static char rcsid[] = "@(#)$Id: save_opts.c,v 5.7 1993/09/27 01:51:38 syd Exp $";
  2328.   
  2329.   /*******************************************************************************
  2330. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  2331.    *
  2332.    *            Copyright (c) 1988-1992 USENET Community Trust
  2333.    *            Copyright (c) 1986,1987 Dave Taylor
  2334. ***************
  2335. *** 14,19 ****
  2336. --- 14,41 ----
  2337.    *
  2338.    *******************************************************************************
  2339.    * $Log: save_opts.c,v $
  2340. +  * Revision 5.7  1993/09/27  01:51:38  syd
  2341. +  * Add elm_chown to consolidate for Xenix not allowing -1
  2342. +  * From: Syd
  2343. +  *
  2344. +  * Revision 5.6  1993/08/23  03:26:24  syd
  2345. +  * Try setting group id separate from user id in chown to
  2346. +  * allow restricted systems to change group id of file
  2347. +  * From: Syd
  2348. +  *
  2349. +  * Revision 5.5  1993/08/10  18:54:45  syd
  2350. +  * Elm was failing to write an empty "alternatives" list to elmrc.
  2351. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2352. +  *
  2353. +  * Revision 5.4  1993/08/03  19:03:52  syd
  2354. +  * "*clear-weed-list*" in elmrc was wiped out when one saved the options in elm.
  2355. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  2356. +  *
  2357. +  * Revision 5.3  1993/06/10  02:55:34  syd
  2358. +  * Write options to elmrc even if their values are empty strings.
  2359. +  * Rationalize code that reads and writes weedouts and alternates.
  2360. +  * From: chip%fin@myrddin.sybus.com
  2361. +  *
  2362.    * Revision 5.2  1993/04/12  03:10:54  syd
  2363.    * The onoff macro assumes a boolean option only has values 1 or 0.
  2364.    * This is not true for forms option (may be 2 == MAYBE).
  2365. ***************
  2366. *** 86,92 ****
  2367.         if (rename(newfname, oldfname) < 0)
  2368.           dprint(2, (debugfile, "Unable to rename %s to %s\n", 
  2369.              newfname, oldfname));
  2370. !       (void) chown(oldfname, userid, groupid);
  2371.   
  2372.       }
  2373.   
  2374. --- 108,114 ----
  2375.         if (rename(newfname, oldfname) < 0)
  2376.           dprint(2, (debugfile, "Unable to rename %s to %s\n", 
  2377.              newfname, oldfname));
  2378. !       (void) elm_chown(oldfname, userid, groupid);
  2379.   
  2380.       }
  2381.   
  2382. ***************
  2383. *** 241,247 ****
  2384.           continue;
  2385.   
  2386.           local_value = save_info[x].flags & FL_LOCAL;
  2387. !         s="";
  2388.           switch(save_info[x].flags & DT_MASK) {
  2389.           case DT_MLT:
  2390.           case DT_SYN:
  2391. --- 263,269 ----
  2392.           continue;
  2393.   
  2394.           local_value = save_info[x].flags & FL_LOCAL;
  2395. !         s = NULL;
  2396.           switch(save_info[x].flags & DT_MASK) {
  2397.           case DT_MLT:
  2398.           case DT_SYN:
  2399. ***************
  2400. *** 260,292 ****
  2401.               break;
  2402.   
  2403.           case DT_WEE:
  2404. !             { int len = 0 ,i;
  2405.   
  2406.               add_comment(x, newelmrc);
  2407.               if (!local_value)
  2408.                   fprintf(newelmrc, "### ");
  2409. !             fprintf(newelmrc, "%s = ", save_info[x].name);
  2410. !             len = strlen(save_info[x].name) + 4;
  2411. !             for (i = 0; i < weedcount && strcmp(weedlist[i], "*end-of-defaults*") !=0; i++)
  2412. !                 /* intentional null loop body */;
  2413.   
  2414. !             while (i < weedcount && equal(weedlist[i], "*end-of-defaults*"))
  2415.                   i++;
  2416.   
  2417. !             while (i < weedcount) {
  2418. !                 if (strlen(weedlist[i]) + len > 78) {
  2419.                   if (local_value)
  2420.                       fprintf(newelmrc, "\n\t");
  2421.                   else
  2422.                       fprintf(newelmrc, "\n###\t");
  2423.                   len = 8;
  2424.                   }
  2425. !                 fprintf(newelmrc, "\"%s\" ", weedlist[i]);
  2426. !                 len += strlen(weedlist[i]) + 4;
  2427. !                 ++i;
  2428.               }
  2429. !             fprintf(newelmrc, "\t\"*end-of-user-headers*\"\n");
  2430.               }
  2431.               break;
  2432.   
  2433. --- 282,333 ----
  2434.               break;
  2435.   
  2436.           case DT_WEE:
  2437. !             {    int len, i;
  2438. !             char *w;
  2439.   
  2440.               add_comment(x, newelmrc);
  2441.               if (!local_value)
  2442.                   fprintf(newelmrc, "### ");
  2443. !             fprintf(newelmrc, "%s =", save_info[x].name);
  2444. !             len = strlen(save_info[x].name) + 6;
  2445.   
  2446. !             i = 0;
  2447. !             while (i < weedcount
  2448. !                    && istrcmp(weedlist[i], "*end-of-defaults*"))
  2449.                   i++;
  2450. +             while (i < weedcount
  2451. +                    && !istrcmp(weedlist[i], "*end-of-defaults*"))
  2452. +                 i++;
  2453. +             if (i == 1) {
  2454. +                 /* end-of-defaults in the first position means
  2455. +                 ** that there are no defaults, i.e.
  2456. +                 ** a clear-weed-list has been done.
  2457. +                 */
  2458. +                 fprintf(newelmrc, " \"*clear-weed-list*\"");
  2459. +                 len += 20;
  2460. +             }
  2461.   
  2462. !             while (i <= weedcount) {
  2463. !                 char *w;
  2464. !                 w = (i < weedcount) ? weedlist[i]
  2465. !                 : "*end-of-user-headers*";
  2466. !                 if (strlen(w) + len > 72) {
  2467.                   if (local_value)
  2468.                       fprintf(newelmrc, "\n\t");
  2469.                   else
  2470.                       fprintf(newelmrc, "\n###\t");
  2471.                   len = 8;
  2472.                   }
  2473. !                 else {
  2474. !                 fprintf(newelmrc, " ");
  2475. !                 ++len;
  2476. !                 }
  2477. !                 fprintf(newelmrc, "\"%s\"", w);
  2478. !                 len += strlen(w) + 3;
  2479. !                 i++;
  2480.               }
  2481. !             fprintf(newelmrc, "\n");
  2482.               }
  2483.               break;
  2484.   
  2485. ***************
  2486. *** 295,331 ****
  2487.               int len=0;
  2488.   
  2489.               alts = *SAVE_INFO_ALT(x);
  2490. -             if (!alts) break;
  2491.               add_comment(x, newelmrc);
  2492.               if (!local_value)
  2493.                   fprintf(newelmrc, "### ");
  2494. !             fprintf(newelmrc, "%s = ", save_info[x].name);
  2495. !             len = strlen(save_info[x].name) + 4;
  2496.               for ( ;alts; alts = alts->next) {
  2497. !                 if (strlen(alts->address) + len > 78) {
  2498.                   if (local_value)
  2499.                       fprintf(newelmrc, "\n\t");
  2500.                   else
  2501.                       fprintf(newelmrc, "\n###\t");
  2502.                   len = 8;
  2503.                   }
  2504. !             fprintf(newelmrc, "%s ", alts->address);
  2505. !             len += strlen(alts->address) + 2;
  2506.               }
  2507.               }
  2508. -             fprintf(newelmrc,"\n");
  2509.               break;
  2510.           }
  2511.   
  2512. !         if (*s) {
  2513.           add_comment(x, newelmrc);
  2514. !         if (local_value)
  2515. !             fprintf(newelmrc, "%s = %s\n", save_info[x].name, s);
  2516. !         else
  2517. !             fprintf(newelmrc, "### %s = %s\n", save_info[x].name, s);
  2518. !         }
  2519.           }
  2520.   
  2521.       fclose(newelmrc);
  2522.       if ( elminfo_fd != NULL ) {
  2523. --- 336,373 ----
  2524.               int len=0;
  2525.   
  2526.               alts = *SAVE_INFO_ALT(x);
  2527.               add_comment(x, newelmrc);
  2528.               if (!local_value)
  2529.                   fprintf(newelmrc, "### ");
  2530. !             fprintf(newelmrc, "%s =", save_info[x].name);
  2531. !             len = strlen(save_info[x].name) + 6;
  2532.               for ( ;alts; alts = alts->next) {
  2533. !                 if (strlen(alts->address) + len > 72) {
  2534.                   if (local_value)
  2535.                       fprintf(newelmrc, "\n\t");
  2536.                   else
  2537.                       fprintf(newelmrc, "\n###\t");
  2538.                   len = 8;
  2539.                   }
  2540. !                 else {
  2541. !                 fprintf(newelmrc, " ");
  2542. !                 ++len;
  2543. !                 }
  2544. !                 fprintf(newelmrc, "%s", alts->address);
  2545. !                 len += strlen(alts->address);
  2546.               }
  2547. +             fprintf(newelmrc,"\n");
  2548.               }
  2549.               break;
  2550.           }
  2551.   
  2552. !         if (s) {
  2553.           add_comment(x, newelmrc);
  2554. !         if (!local_value)
  2555. !             fprintf(newelmrc, "### ");
  2556. !         fprintf(newelmrc, "%s = %s\n", save_info[x].name, s);
  2557.           }
  2558. +     }
  2559.   
  2560.       fclose(newelmrc);
  2561.       if ( elminfo_fd != NULL ) {
  2562.  
  2563.